1

I'm using a master config file based on this one, in an MSM install of EE2 (2.5.5).

In the config file, I set the base path and url like so:

$base_url = $protocol . "://" . $_SERVER['HTTP_HOST'];
$base_path = $_SERVER['DOCUMENT_ROOT'];

This works a treat, but, I exclusively access the CP via my default site /admin - e.g. https://www.default_site.com/admin/

When I switch MSM sites in the CP, the thumbnails in my matrix file type custom fields break, because they are looking for the files in the default site rather than the MSM site I have just switched to.

Apart from accessing the CP via my other MSM site url, is there a way to get thumbnails working in this scenario? (I cannot find any config overrides specific to thumbnails, apart from the prefix value).

Note: All other file paths, file upload prefs, and front-end files work correctly - it's just the thumbnails in the CP, for the 2nd MSM site, that are broken.

2 Answers 2

1

Since you are editing site_2 from the domain of site_1/default_site, you'll need to better define your sites' url and paths with config settings.

$env_config['default_site_path']        = '/path/to/default_site/root';
$env_config['default_site_url']         = 'http://www.default_site.com';

$env_config['site_2_path']          = '/path/to/site_2/root';
$env_config['site_2_url']           = 'http://www.site_2.com';

$env_config['upload_preferences'] = array(
        1 => array(
            'name'        => 'Images for Default Site',
            'server_path' => $env_config['default_site_path'] . '/assets/images/',
            'url'         => $env_config['default_url']  . '/assets/images/'
        ),
        2 => array(
            'name'        => 'Images for Site 2',
            'server_path' => $env_config['site_2_path'] . '/assets/images/',
            'url'         => $env_config['site_2_url']  . '/assets/images/'
        ),
        3 => array(
            'name'        => 'Mug Shots for Site 2',
            'server_path' => $env_config['site_2_path'] . '/assets/images/mugshots/',
            'url'         => $env_config['site_2_url']  . '/assets/images/mugshots/'
        )
    );

Two notes:

  1. File upload directories for all MSM sites have a unique id to use in the SAME array.

  2. If you are using multiple environments where the path and url configs will change, then add this to your config.local.php, config.prod.php, config.dev.php, etc, with the appropriate settings for that environment.

0

I use a custom config.php and one of the things I set up in mine (which it looks like the one you are using hasn't) is upload destinations:

// -------------------------------------
// Custom upload directory paths
// -------------------------------------

$env_config['upload_preferences'] = array(
    1 => array(
        'name'        => 'Images',
        'server_path' => $base_path . 'uploads/images/',
        'url'         => $base_url  . 'uploads/images/'
    ),
    2 => array(
        'name'        => 'Videos',
        'server_path' => $base_path . '/uploads/videos',
        'url'         => $base_url  . '/uploads/videos/'
    )
    // ...
);

Note: The array keys relate to the ID of the upload destination, which must be created via the control panel otherwise this will have no effect.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.