Interesting. Have you run into performance issues? Do you then delete the cached file or do you leave it for future requests? That was the second thing I was wondering if I should save then the first time and mark those as resized so I don't run it again next time. The only benefit I see with doing it each time is that you can specify a different file size whenever you'd like and it doesn't have to recreate anything into a cache.
John Burns Certified Advanced ColdFusion MX Developer Wyle Laboratories, Inc. | Web Developer -----Original Message----- From: Katz, Dov B (IT) [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 25, 2006 12:29 PM To: CF-Talk Subject: RE: Image resizing on the fly? I've done this before. Basically what I do is create a Image proxy.... Assuming you have W, H, and ImageFilename variables, and that you pretty much want a specific dimension most of the time.... You can create imageProxy.cfm?file=/myfiles/photo.jpg&w=600&h=400 ImageProxy.cfm will do a <CFIF NOT fileExists(expandpath(".#w#_#h#/#imagefilename#"))> <CFLOCK name="some-derivative-of-the-filename"> <CF_RESIZE_IMAGE_TO_THAT_PATH> </cflock> </CFIF> <Cfset pageContext.forward(".#w#_#h#/#imagefilename#"> This is the general idea, so 9 times out of 10 it just forwards your request onward... Dov -----Original Message----- From: Burns, John D [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 25, 2006 12:19 PM To: CF-Talk Subject: Image resizing on the fly? I've been using ImageCR3 to do some image resizing and in the past I've used imagemagick and alagad's image component. I've always done it where I've done file resizing at the time of upload. However, I'm facing a situation of having to display an unknown amount of directories of photos that are being uploaded into folders via FTP. Rather than forcing someone to go fire off a page that goes out and does all the resizing, I'm wondering if it would be feasible to resize the images as needed. I'm not sure what the overhead would be on something like that. I've seen some .NET developers doing it with something called image.ashx where they call their images like <img src="image.ashx?file=/myfiles/photo1.jpg&width=600&height=400"> and it appears to just do the resizing everytime someone hits that image. I was thinking of writing a CFM that did the same thing by resizing the photo and pass it back to the browser using <cfcontent> but I wasn't sure if the overhead is too much. This isn't a large site and there won't be a ton of people hitting it at once, but even 2 or 3 people on there pulling up a page of 20-30 thumbnails with each image being resized on the fly sounds a little scary to me. I'm just looking for some more knowledge and expertise on the subject. Thanks! John Burns Certified Advanced ColdFusion MX Developer Wyle Laboratories, Inc. | Web Developer ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:238637 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54