Prevent image renaming?

Permalink Browser Info Environment
Hi Jordan

Thank you for this awesome add-on - it makes my photos look so good!

Just wondering if there was a way to prevent SFG from renaming my image files though?

I want to take advantage of the SEO benefits of keyword-rich file names, but notice that all my gallery images have been changed to names like: "a3479596a5dc82c31214294dd2eaa81c.jpg" :-(

If you could point me in the right direction, I am happy to make code edits myself.

Thanks!

Type: Discussion
Status: New
malkau
View Replies: View Best Answer
jordanlev replied on at Permalink Reply
jordanlev
Hi Mal,
The file renaming is due to the fact that the image gallery is creating thumbnails for them so that they're properly sized. This uses built-in C5 functionality so it is not really possible to change unless you were to rewrite parts of the system to use the same filename as the original which would require an extraordinary amount of development effort.

Another option which would be trivial to implement is to not create thumbnails of the "enlarged" full-sized images. This would mean you have to ensure the full sized images are uploaded at a proper size for the lightbox (basically no bigger than the standard width of someone's screen -- 900px wide or so). That being said, I'm not 100% sure this would solve the problem because I don't know if Concrete5 renames the images as soon as you upload them or not (an easy way to check is to upload an image, then in the file manager click on it and choose "View" from the popup menu, and see what the url is).
If this works for you, let me know and I can tell you how to alter the code.

-Jordan
malkau replied on at Permalink Reply
malkau
Hi Jordan

I checked and the uploaded files do retain their filename - so the alternative option you suggested would work for me. Can you please let me know how to do that?

I actually already resized my larger images to the exact size I wanted them zoomed to - I didin't realise that the add-on would resize it for me :-)

Thanks so much!
- Mal
jordanlev replied on at Permalink Best Answer Reply
jordanlev
Cool. Here's how you can do this:

* Edit this file:
YOURSITE/packages/sortable_fancybox_gallery/blocks/sortable_fancybox_gallery/controller.php


* Find these lines of code (should start around line #44):
$full = $ih->getThumbnail($file, $this->fullWidth, $this->fullHeight);
$image['full_src'] = $full->src;
$image['full_width'] = $full->width;
$image['full_height'] = $full->height;


* Delete all of those lines and in their place put this code:
$image['full_src'] = $file->getRelativePath();
$full_size = @getimagesize($file->getPath());
$image['full_width'] = $full_size[0];
$image['full_height'] = $full_size[1];


That should do it, but let me know if you get any errors or the images don't show up properly.

-Jordan
jordanlev replied on at Permalink Reply
jordanlev
Oops, one more thing -- in that same controller.php file, you also want to replace this line (around line #59):
$max_row_height = ($full->height > $max_row_height) ? $full->height : $max_row_height;

...with this:
$max_row_height = ($image['full_height'] > $max_row_height) ? $image['full_height'] : $max_row_height;
malkau replied on at Permalink Reply
malkau
Thanks Jordan - your workaround works well.

Thank you!

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.