Hello,

On 09/14/2004 12:22 AM, Kevin Coyner wrote:
I'm working on a website where I'd like to display a thumbnail from a
repository of jpg's of normal (@ 800x600 px) size.  Each time a user
comes to this page, I'd like to show a new thumbnail from a different
image in the repository.

Obviously I could simple resize all the jpg's to my desired size and
stick them in a thumbnail-repository and randomly call them up. I'm
o.k. with this approach and will probably do it.


But I've also played around with imagejpeg and imagecreatetruecolor, and
have put together a small function that takes a jpg from the repository,
sizes it to thumbnail, and then displays it in the browser.

This is real slick and a nice solution, but is there a performance hit
there that might slow down page loads for viewers? I know it's all
server-side, but my impression is that resizing pics is generally CPU
intensive and takes a second or two.

Why don't you just cache the generated thumbnails on demand? I mean store the generated thumbnail image data in a different cache file for each image only it is requested for the first time.


You may want to try this generic file cache class that has support for dealing with concurrency and prevent the eventual corruption of cache files when more than user is requesting a given thumbnail with cache files that needs to be generated or updated .

http://www.phpclasses.org/filecache


--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to