TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Generating thumbnails on the fly (http://www.talkphp.com/general/3735-generating-thumbnails-fly.html)

Jmz 12-08-2008 11:27 AM

Generating thumbnails on the fly
 
I have a site that lets a user create multiple galleries. For each gallery they can upload an image to be the image for that gallery.

I want to generate a thumbnail for each gallery to display on a page, however depending on the template they have selected (in another part of the control panel) the thumbnails should be a different size.

Am I better off generating the thumbnails (either using PHPThumb or the GD library) on the fly each time this page is loaded or should I generate the thumbs as the gallery is created and then re-generate all of the current thumbs if/when they change their template?

Orc 12-09-2008 07:25 AM

Quote:

Originally Posted by Jmz (Post 20340)
I have a site that lets a user create multiple galleries. For each gallery they can upload an image to be the image for that gallery.

I want to generate a thumbnail for each gallery to display on a page, however depending on the template they have selected (in another part of the control panel) the thumbnails should be a different size.

Am I better off generating the thumbnails (either using PHPThumb or the GD library) on the fly each time this page is loaded or should I generate the thumbs as the gallery is created and then re-generate all of the current thumbs if/when they change their template?

What I would do is generate the thumbs as the gallery is created, and regenerate the thumbs when they change their template.

From my experience, it seems if you resize thumbs straight from a php file, it's slower than actually generating them and storing them in a cache, so I would cache the thumbnails, and put a path in the database to the thumbnail, in which you could use <img src="" /> to fetch the image from the path, so being it's faster than generating straight from a php file.

Jmz 12-09-2008 03:07 PM

Ok thanks, I'll do that.

Any idea which would be better to use? PHPThumb, GD or something else?

Orc 12-10-2008 12:34 AM

Quote:

Originally Posted by Jmz (Post 20365)
Ok thanks, I'll do that.

Any idea which would be better to use? PHPThumb, GD or something else?

What is PHPThumb? Is it an external library outside of PHPs core?

Jmz 12-10-2008 09:10 AM

You can see the PHPThumb site here. I've never used it before but the wordpress skin I use for one of my sites uses it.

Apparently it uses the GD library and ImageMagick to produce the thumbnails. I was just wondering what benefits it has over using the GD library itself.

Orc 12-10-2008 09:17 AM

Quote:

Originally Posted by Jmz (Post 20412)
You can see the PHPThumb site here. I've never used it before but the wordpress skin I use for one of my sites uses it.

Apparently it uses the GD library and ImageMagick to produce the thumbnails. I was just wondering what benefits it has over using the GD library itself.

Well if it improves the GD Library, I would go with it. Although ImageMagick isn't part of the PHP Core, but if you have a dedicated server you could install it, or contact your host to install it.


All times are GMT. The time now is 04:45 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0