• Hi,

    Every since I upgrade my NextGEN Gallery to latest version, it break all the URL to my images, specifically to the one with filename contain spaces.

    What I observe is, NextGEN Gallery will automatically replace spaces with “+” if the URL contain space, and apparently NextGEN Gallery doesn’t process URL with “+” well, causing the image not showing.

    I tried to disable NextGEN Gallery and reproduce the issue with build in media manager, things are working fine because WordPress will replace spaces with “-” by renaming the files.

    Gallery

    https://www.ads-software.com/plugins/nextgen-gallery/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor photocrati

    (@photocrati)

    @hwa – Although we have corrected this issue with spaces in file names to the best of our knowledge what I am seeing on your site is another issue altogether.

    I’m seeing +-+ as the replacement for spaces?!

    As it is, you can comment out the following line from function nextgen_esc_url():

    $url = str_replace( '%', '%25', $url );

    … and add the following hook/callback to your your current theme’s functions.php:

    add_filter('ngg_get_image_url', 'ngg_replace_plus_with_percenttwenty', 10, 3);
    function ngg_replace_plus_with_percenttwenty($url, $image, $size) {
        return str_replace('+', '%20', $url);
    }

    See if that helps to sort out this issue (it will not likely “fix” any existing displays/galleries).

    Thanks!

    – Cais.

    Thread Starter hwa

    (@hwa107)

    Hi Cais,

    Thanks, the filter fix the issue, but $url = str_replace( '%', '%25', $url ); doesn’t give any effect. So I just add the filter.

    I consider the filter as a hack/workaround, may I know is this a known issue? Since this only happen after upgrade, is there any bugs report for this?

    Thanks again.

    Plugin Contributor photocrati

    (@photocrati)

    @hwa – For the most part the hook/callback work-around will only be a temporary measure but for some sites/server environments it may still be a requirement.

    After the next update of NextGEN Gallery you could try not using the hook/callback to see if you still need it or not.

    Thanks!

    – Cais.

    Just wanted to add that suddenly I am experiencing the same issue. When I replace the space with a hyphen, everything works fine:

    https://www.evanpike.com/2010/04/amy-take-two-portrait-photographe/

    Plugin Contributor photocrati

    (@photocrati)

    @evanpike – Thanks for sharing your work-around.

    – Cais.

    I guess it’s a work around, but would prefer a fix for the plugin though as I don’t have time to go through my blog and find all images that have spaces in them and then rename all of them… I’m not sure I understand what to do with the code above.

    Plugin Contributor photocrati

    (@photocrati)

    @evanpike – We have corrections committed to our next release branch which should sort this out. IF the issue persists after that release please start your own topic so we can continue to review your specific issue.

    Thanks!

    – Cais.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Not Showing Images For Filename Contain Spaces’ is closed to new replies.