RE: Image resizing on the fly?

2006-04-26 Thread Burns, John D
Rick-

I agree and that's what I'm leaning toward. The only thing I don't like
is that if I want to change dimensions of all the images for some
reason, I have to go back through and run everything over again. The big
thing that prompted this question was that I saw .Net people using
image.ashx (do a google search on it) and it seems they do it on the fly
everytime. I'm not sure if .net is just better at doing it with very
little overhead or if the people doing it are a timebomb waiting to
explode on their server if they ever get significant traffic. 


John Burns
Certified Advanced ColdFusion MX Developer
Wyle Laboratories, Inc. | Web Developer
 

-Original Message-
From: Rick Root [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 25, 2006 1:16 PM
To: CF-Talk
Subject: Re: Image resizing on the fly?

John,

Since you don't want to always be resizing on the fly every time someone
views an image, you might try something like this:

img src=showImage.cfm?foo=myImage.jpg

and in showImge.cfm just use imageCFC to read the image dimensions.  If
the image hasn't been resized, resize it and save it back.  Then use
cfcontent to send the image.

That way every time you display the image, the only added overhead would
be getting the image dimensions.

ALTERNATIVELY, save the resized image with a different filename like
myImage_resized.jpg and then have showImage.cfm check for the
existence of the file - if it's not there, resize the original image and
save it.

Then you're not even calling java to get image dimensions, you're only
checking for the existence of a file with a specific name.

ultimately, you're better off not doing any of this dynamic stuff cuz it
won't scale.  You'd be better off using some kind of event gateway
directory watcher and just resizing the images as they appear.

rick



~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:238791
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=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


Re: Image resizing on the fly?

2006-04-26 Thread Rick Root
Burns, John D wrote:
 everytime. I'm not sure if .net is just better at doing it with very
 little overhead or if the people doing it are a timebomb waiting to
 explode on their server if they ever get significant traffic. 

I'd wager the latter.  =)

Rick

~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:238818
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


Image resizing on the fly?

2006-04-25 Thread Burns, John D
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.jpgwidth=600height=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:238619
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=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54


RE: Image resizing on the fly?

2006-04-25 Thread Ben Nadel
John,

Although it takes a high performance hit, if you wanted to do it on the fly,
I have done this with the Alagad Image Component:

!--- Create the Allagad image component ---
cfset objImage = CreateCFC(Image) /

!--- Read in the image ---
cfset objImage.ReadImage(  FULL PATH .) /

!--- Scale the image ---
cfset objImage.ScaleWidth(URL.thumb_size) /

!--- Write the image data directly to the browser stream ---
cfset objImage.WriteToBrowser(JPG, 80) / 


Its nice that the Image component has a write to Browser method for the
binary stream.

...
Ben Nadel 
www.bennadel.com
-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.jpgwidth=600height=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:238633
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


RE: Image resizing on the fly?

2006-04-25 Thread Burns, John D
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.jpgw=600h=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.jpgwidth=600height=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


Re: Image resizing on the fly?

2006-04-25 Thread Rick Root
John,

Since you don't want to always be resizing on the fly every time someone 
views an image, you might try something like this:

img src=showImage.cfm?foo=myImage.jpg

and in showImge.cfm just use imageCFC to read the image dimensions.  If 
the image hasn't been resized, resize it and save it back.  Then use 
cfcontent to send the image.

That way every time you display the image, the only added overhead would 
be getting the image dimensions.

ALTERNATIVELY, save the resized image with a different filename like 
myImage_resized.jpg and then have showImage.cfm check for the 
existence of the file - if it's not there, resize the original image and 
save it.

Then you're not even calling java to get image dimensions, you're only 
checking for the existence of a file with a specific name.

ultimately, you're better off not doing any of this dynamic stuff cuz it 
won't scale.  You'd be better off using some kind of event gateway 
directory watcher and just resizing the images as they appear.

rick

~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:238656
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


RE: Image resizing on the fly?

2006-04-25 Thread Katz, Dov B \(IT\)
Another solution would probably be the most load tolerant, but relies on
some client behavior

If you did something like

img src=resized/#realPath# onerror=fix(this,'#realPath#');

script language=javascript
function fix(img,path){
   if(img.src.indexOf(.cfm)==-1){
img.src=fix.cfm?path=+path;
   }
}
/script 

Something like this...
Then fix.cfm can Create the resized image, and CFLOCATION the user to
it...

Just a thought, though I've never done it...

Benefit here is:  only the first request will call the CFM, (when file
is not found, etc).  

Disadvantage,  There is a subtle and slight broken image appearance as
the secondary requests are sent

Dov

-Original Message-
From: Rick Root [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 25, 2006 1:16 PM
To: CF-Talk
Subject: Re: Image resizing on the fly?

John,

Since you don't want to always be resizing on the fly every time someone
views an image, you might try something like this:

img src=showImage.cfm?foo=myImage.jpg

and in showImge.cfm just use imageCFC to read the image dimensions.  If
the image hasn't been resized, resize it and save it back.  Then use
cfcontent to send the image.

That way every time you display the image, the only added overhead would
be getting the image dimensions.

ALTERNATIVELY, save the resized image with a different filename like
myImage_resized.jpg and then have showImage.cfm check for the
existence of the file - if it's not there, resize the original image and
save it.

Then you're not even calling java to get image dimensions, you're only
checking for the existence of a file with a specific name.

ultimately, you're better off not doing any of this dynamic stuff cuz it
won't scale.  You'd be better off using some kind of event gateway
directory watcher and just resizing the images as they appear.

rick



~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:238674
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


RE: Image resizing on the fly?

2006-04-25 Thread Terry Troxel
I also use ImageCR and love its speed.
I have a wedding photgrapher's sit that
He uses an ftp package to upload all the
Images of a wedding (he wanted it this way)
With a naming convention of weddingname-1, weddingname-2,
etc.
To his events folder. He then goes into his admin area of
the site
And runs a page to add an event which means he adds the
weddingname
And a password for the event. When he submits the page it
adds those
Fields into his events page for username/password to allow
people to
View/purchase the pics, but it runs cfdirectory with a
filter of the
Weddingname and uses imageCR to create a thumbnail of each
of the
Files returned from the cfdirectory query.

Terry 

-Original Message-
From: Burns, John D [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 25, 2006 9:19 AM
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.jpgwidth=600height=40
0 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:238685
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=89.70.4
Donations  Support: http://www.houseoffusion.com/tiny.cfm/54