CodeIgniter Forums
Image_lib and thumbnail names - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Image_lib and thumbnail names (/thread-2732.html)



Image_lib and thumbnail names - El Forum - 08-21-2007

[eluser]stevefink[/eluser]
Apologies for making a third post in the last two hours. I'm having a difficult time working with image_lib and GD. Although I have it successfully creating thumbnails for me, the filename it saves it as makes it hard for me to load the thumbnails without using the overhead of regular expressions.

For instance if I upload foo.jpg to the server, using the following code:

Code:
// let's create a thumbnail while we're here.
            $config['image_library'] = 'GD2';
            $config['source_image'] = "$uploadFile";
            $config['new_image'] = "$uploadDir/$filename";
            $config['create_thumb'] = TRUE;
            $config['maintain_ratio'] = TRUE;
            $config['width'] = 75;
            $config['height'] = 50;

It gets saved as foo_thumb.jpg. Is there anyway to perhaps save it as thumb_foo.jpg instead? This would be easier so when I load images after upload to the server, I can do something like:

<img src="thumb_$file">

If that's not possible, I need an easy way to find thumbnails when I search a directory from recently uploaded files. I want the only thumbs to get loaded into the view versus the original image cause some of them are huge.

Thanks for any suggestions all.

- sf