In which case, here's something I just did for a thumbnail upload. Basically, these have a maximum size below which they are unaltered. I used imageMagick for the transformation, but it was a bit overkill for the basic size check, so I used imageInfo which is much quicker (http://www.geocities.com/marcoschmidt.geo/image-info.html)
<!--- User wants to specify a thumbnail file ---> <cffile action = "upload" fileField = "thumbfile" destination = "#request.uploadPath#thumbs#request.filesep#" nameConflict = "MakeUnique" accept = "#request.thumbFileMimes#"> <cfset request.uploadedThumbFilename = cffile.serverFile> <!--- Now we use an imported Java class (ImageInfo) to ascertain the size of the uploaded thumb. The class needs a FileInputStream object to read ---> <cfset inputstream = CreateObject("Java", "java.io.FileInputStream")> <!--- Load the thumbnail file into the input stream ---> <cfset inputstream.init("#request.uploadPath#thumbs#request.filesep##request.uploadedThumbFilename#")> <!--- Load the ImageInfo class ---> <cfset imageinfo = CreateObject("Java", "ImageInfo")> <!--- Set the ImageInfo's input, which causes it to examine the image file ---> <cfset imageinfo.setInput(inputStream)> <!--- Check that the image is OK ---> <cfif imageinfo.check()> <cfif imageinfo.getwidth() gt request.maxImageWidth> <!--- Image is outside the acceptable width, so we use imageMagick to resize it. Note that the width is the limiting factor, and that the height is scaled accordingly.---> <cf_magicktag inputtype="file" inputfile="#request.uploadPath#thumbs#request.filesep##request.uploadedThumbFilename#" timeout="100" action="convert" outputType="file" outputFile="#request.uploadPath#thumbs#request.filesep##request.uploadedThumbFilename#"> <cf_magickaction action="geometry" width="#request.maxImageWidth#" height="#int(imageinfo.getHeight()*(request.maxImageWidth/imageinfo.getWidth()))#"> </cf_magicktag> </cfif> <cfelse> <!--- Image failed imageinfo check - that's bad, so abort. ---> <cflocation url="#request.self#?fuseaction=#fusebox.circuit#.error&errorindex=2" addtoken="No"> </cfif> </cfif> HTH R ----- Original Message ----- From: Adam Reynolds To: [EMAIL PROTECTED] Sent: Thursday, November 06, 2003 11:29 AM Subject: RE: [ cf-dev ] Image manipulation 6.1 under win2003. ImageMagick is looking interesting. > -----Original Message----- > From: Stephen Moretti [mailto:[EMAIL PROTECTED] > Sent: 06 November 2003 11:21 > To: [EMAIL PROTECTED] > Subject: Re: [ cf-dev ] Image manipulation > > > What version of CF and OS?? > > Stephen > > Adam Reynolds wrote: > > > Anybody have any example CF code that manipulates image sizes etc. > > > > I need to resize an image upload to 500 pixels wide, and create > a thumbnail > > 150 pixels wide. > > > > Currently I have a client that is loading very big images on to > a site, and > > want to get sort this out sometime next week, as it is abusive > to end users. > > > > Adam > > > > > > > > > > > -- > ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ > > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > For human help, e-mail: [EMAIL PROTECTED] > > -- ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/ To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] For human help, e-mail: [EMAIL PROTECTED]