You can get the best of both worlds very easily.  Create an empty
directory to store all your thumbnails, and then write them all as
"/thumbs/IMAGEID-WIDTH-HEIGHT.jpg" into your pages.  Then use
mod_rewrite to do a file existence check.  If it exists, let Apache
serve it out, otherwise have mod_rewrite forward to a CF script that
will take the full-size image, resize it to the proper dimensions,
write it to the thumbnails directory (so subsequent requests will
bypass CF), and then return the image's bytes.

You don't generate any thumbnails that aren't needed, and you never
generate the same thumbnail twice.  And if you ever change the way
thumbnails are generated (add a watermark, use a different
compression, etc.), you only need wipe that directory clean and
everything will start being regenerated.  Similarly, if you ever
update a given image, you need only delete the thumbnails that start
with that imageID, and they'll be regenerated as well.

cheers,
barneyb

On Tue, Sep 2, 2008 at 7:46 AM, Azadi Saryev <[EMAIL PROTECTED]> wrote:
> i totally agree with Claude: unless there is a better reason to not have
> thumbnail-sized images, you should not tax your server with all the
> cfimage resizing - it is a very memory-intensive operation. i use this
> on-the-fly functionality on one of the sites to add a watermark to a
> large-size preview image for non-registered viewers. but i definitely
> would not use this to create and display thumbnails...
>
> but... if you are set in your way, look at imageUtils cfc on riaforge -
> Ray & Ben & Co have made a great job with it. it includes a custom
> imagewritetobrowser function that can add alt, style and lots of other
> html attributes to the img tag it produces.
>
> Azadi Saryev
> Sabai-dee.com
> http://www.sabai-dee.com/
>
>
>
> Claude Schneegans wrote:
>>  >>Any oppinion is appreciated.
>>
>> Well, IMO, the big idea of thumbnails is to show many images roughly and
>> in the same page,
>> so that the user can choose only the one in want in large format.
>> Having to read and downsize 10 or 20 or more images is not really
>> compatible with this purpose.
>> The images are not sent over the Internet, but the server is kept busy
>> unnecessarily.
>>
>> The only reason I would see an advantage would be a situation were you
>> have millions
>> of images so that the probability for any image to appear in a thumbnail
>> page is very low.
>> Otherwise, I would produce the thumbnail images once for ever,... until
>> you change your mind,
>> .... and unless you change your mind every day ;-)
>>
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311910
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to