WordPress.org

Ready to get started?Download WordPress

Forums

NextGEN Gallery
Thumbnail filenames different than URL's used to display (5 posts)

  1. MScharf
    Member
    Posted 8 months ago #

    Hello everyone!

    I seem to have lost all thumbnail images in the admin area. A bit of investigation has led me to believe the program saves the thumbnail files with a different name from what I see used in the html markup of the Manage Gallery (and all other pages).

    For example, I have a file called "This is a great photo.jpg". When I generate a thumbnail, in the thumbs folder I see "thumbs_This is a great photo.jpg". However, the html markup in Manage Gallery page is trying to load file "thumbs_Thisisagreatphoto.jpg".

    Reading a bit online, I tried changing the filename in the ngg_pictures filename field, and also renaming the file, to "This_is_a_great_photo.jpg". Sadly, the thumbnail image is named exactly as it was before. So, I changed the photo name entirely to "This_WAS_a_great_photo.jpg" and strangely the exact same thumbnail image filename appears from before the name change.

    Where does NextGen generate the filename for thumbnail images?

    Where does NextGen generate the thumbnail image url's used to show the thumbs in the Manage Gallery pages?

    Could this be a bug?? I've spent several hours trying to get thumbs working in admin area, but with the new plugin folder structure I simply cannot find where to fix this.

    Thanks for any help!

    http://wordpress.org/plugins/nextgen-gallery/

  2. MScharf
    Member
    Posted 8 months ago #

    It seems that NextGen Gallery Plugin is now intolerant of image filenames that contain spaces. Since I have a few thousand images, all with spaces in filenames, and I had tried changing the filenames without success (see my first post), I located the lines to change that should fix thumbnail image issues in the admin screens. Please be aware that these are core files and changes will need re-applied after upgrading the plugin.

    To fix the Sort Gallery page, open up:

    /nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/manage-sort.php

    change the following line (126) from:

    <div class="imageBox_theImage" style="background-image:url('<?php echo esc_url( $picture->thumbURL ); ?>')"></div>

    to:
    <div class="imageBox_theImage" style="background-image:url('<?php echo $picture->thumbURL; ?>')"></div>

    To fix the thumbnail images in Manage Galleries area, open up:

    /nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/manage-images.php

    change the following line (~510) from:

    <img class="thumb" src="<?php echo esc_url ( add_query_arg('i', mt_rand(), $picture->thumbURL) ); ?>" id="thumb<?php echo $pid ?>" />

    to:
    <img class="thumb" src="<?php echo add_query_arg('i', mt_rand(), $picture->thumbURL); ?>" id="thumb<?php echo $pid ?>" />

    When clicking on View under the images on Manage Gallery page, the popup also
    fails to load the image. To correct this and make the image display once again,
    open up:

    /nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/admin/manage-images.php

    change the following line (~484) by removing the esc_url function that wraps $picture->imageURL. (couldn't put that piece of code in the post here, sorry.)

    It seems the esc_url function provided by wordpress cannot tolerate the spaces, and may need some work. For now though, removing that from the plugin code has fixed my problems.

    Photocrati, please consider fixing this issue in a future release. I'm sure most Windows users will have some photos with spaces in filenames. Since making these simple changes fixed the problem I was having, and images now display just fine, there seems to be no need for this aggressive cleansing of image urls.

    I hope this helps someone else out there in WordPress Land.

  3. photocrati
    Member
    Plugin Author

    Posted 8 months ago #

    @MSharf - Thanks for all of this work and troubleshooting, I will pass these details along to our developers so they can review what you are doing to see how we may be able to implement something to sort this out.

    - Cais.

  4. photocrati
    Member
    Plugin Author

    Posted 8 months ago #

    @MSharf - After some further investigation into this issue one of our developers noted this WordPress trac ticket: http://core.trac.wordpress.org/ticket/23605

    Since we are making every effort to keep to WordPress best practices we used the esc_url function where it is to be expected. Would it be possible for you to check after you next update to see if you are able to use these galleries / images via the ATP (aside from them not actually being visible via Manage Galleries)?

    Please let us know what you find out by submitting your results via a Bug Report (http://www.nextgen-gallery.com/report-bug/ ... please reference this topic).

    Thanks!

    - Cais.

  5. MScharf
    Member
    Posted 8 months ago #

    In light of the apparent lack of interest in fixing the issue at the WP core level, it makes sense for Photocrati to address within the plugin. It looks pretty bad when thumbnails don't show up in a photo management plugin, regardless of what the underlying issue is.

    Keeping to "best practices" is a noble cause, but the space-stripping behavior of esc_url() means it's currently not the right function for this task.

    Just my 2 cents.
    Thanks so much for looking into this!

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.