Re: GD Image Resizing on the fly.

From: Date: Fri, 19 Nov 2004 20:28:02 +0000
Subject: Re: GD Image Resizing on the fly.
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-25006@lists.php.net to get a copy of this message
Tony Devlin wrote:
Hello Everyone,
    I am looking for a script or guidance in where to look to figure out how
to create a php script that resizes an image on the fly when it is called(...)
Image resizing takes a lot of cycles. As opposed to generating a thumbnail every time a visitor comes to your site, cache it. /* PHP Psuedocode */ thumbnail_file = thumbnail-cache/product.png if(file_exists(thumbnail_file)) print <img src=thumbnail_file /> else generate_thumbnail(source, thumbnail_file); print <img src=thumbnail_file /> This way, the expensive GD hits only take place once, when the thumbnail is first created. Otherwise, you may get a visitor who constantly refreshes and drives up your load average -- and on shared hosting, this can be problematic. -- _ (_)___ Jed Smith, Code Ninja | / __| RFBs: [email for info] | \__ \ +1 (541) 606-4145 _/ |___/ jed@jed.bz (Signed mail preferred: PGP 0x703F9124) |__/ http://personal.jed.bz/keys/jedsmith.asc

« previous php.windows (#25006) next »