If set_size needs a reference to the image object, return the image object from init_image and then pass it to the set_size function.
Adrian http://www.adrianlynch.co.uk/ -----Original Message----- From: Daniel Kessler [mailto:[EMAIL PROTECTED] Sent: 14 May 2008 15:18 To: CF-Talk Subject: image size setup Recently, someone has posted how to check image sizes using java in CF. I have hundreds of images to check on one page where the images are entered by users. On the code that was posted, a java object is created and then a pict is assigned to it. It would seem that since I am doing lots of images, I shouldn't create an image object each time, just the picture object (f). So I broke them into two batches of script, but I'm getting the error stating that imgRdr is undefined (cause it's in another function). I'm not sure how to reference this var or if the rest of this is gonna work or if it's a good idea at all. Any thoughts? Here's the code: <cfscript> function init_image (){ imgObj = CreateObject ("java","java.awt.image.BufferedImage"); imgRdr = CreateObject ("java","javax.imageio.ImageIO"); } function set_size(image_name){ f = CreateObject("java","java.net.URL").init ('http://www.sph.umd.edu/images/careerexpo.jpg'); imgObj = imgRdr.read(f); imgObj.imageWidth = imgObj.getWidth(); imgObj.imageHeight = imgObj.getHeight(); return imgObj; } </cfscript> -- Daniel Kessler University of Maryland College Park School of Public Health 3302E HHP Building College Park, MD 20742-2611 Phone: 301-405-2545 http://sph.umd.edu ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;192386516;25150098;k Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:305237 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

