***CORRECTED AGAIN***
This should work provided all your Osclass installation are in the same server.
First make a backup of the files you have been modifying for this and restore the original ones.
Add this at the very bottom of your theme functions.php (on both installations):
Notes:
1.- Take care not to leave blank lines after this.
2.- If your theme functions.php doesn't end with ?> skip first line of my code.
<?php
function cust_move_images_to_main_domain($resource) {
$mainPath = '/path-to-your-main-domain-root-folder/'; // Change to your main domain installation root folder
if (osc_base_path() != $mainPath) {
$currentFolder = osc_base_path().$resource['s_path'];
if(!is_dir($mainPath.$resource['s_path'])) {
if (!mkdir($mainPath.$resource['s_path'], 0755, true)) {
return; // PATH CAN NOT BE CREATED
}
}
rename($currentFolder.$resource['pk_i_id'].'.'.$resource['s_extension'], $mainPath.$resource['s_path'].$resource['pk_i_id'].'.'.$resource['s_extension']);
rename($currentFolder.$resource['pk_i_id'].'_preview.'.$resource['s_extension'], $mainPath.$resource['s_path'].$resource['pk_i_id'].'_preview.'.$resource['s_extension']);
rename($currentFolder.$resource['pk_i_id'].'_thumbnail.'.$resource['s_extension'], $mainPath.$resource['s_path'].$resource['pk_i_id'].'_thumbnail.'.$resource['s_extension']);
if( osc_keep_original_image() ) {
rename($currentFolder.$resource['pk_i_id'].'_original.'.$resource['s_extension'], $mainPath.$resource['s_path'].$resource['pk_i_id'].'_original.'.$resource['s_extension']);
}
}
}
osc_add_hook('uploaded_file', 'cust_move_images_to_main_domain');
function cust_change_resource_path($url) {
$mainUrl = 'http://mydomain.com/'; // Change to your main domain URL
return str_replace(osc_base_url(), $mainUrl, $url);
}
osc_add_filter('resource_path', 'cust_change_resource_path');
function cust_delete_resource($resource) {
$mainPath = '/path-to-your-main-domain-root-folder/'; // Change to your main domain installation root folder
if (osc_base_path() != $mainPath) {
@unlink($mainPath . $resource['s_path'] . $resource['pk_i_id'] . "." . $resource['s_extension']);
@unlink($mainPath . $resource['s_path'] . $resource['pk_i_id'] . "_original." . $resource['s_extension']);
@unlink($mainPath . $resource['s_path'] . $resource['pk_i_id'] . "_thumbnail." . $resource['s_extension']);
@unlink($mainPath . $resource['s_path'] . $resource['pk_i_id'] . "_preview." . $resource['s_extension']);
}
}
osc_add_hook('delete_resource', 'cust_delete_resource');
?>
Change path and URL in these lines:
$mainPath = '/path-to-your-main-domain-root-folder/'; // Change to your main domain installation root folder
(2 occurrences)
$mainUrl = 'http://mydomain.com/'; // Change to your main domain URL
Regards