<cfset imgFile =
createObject("java","javax.swing.ImageIcon").init(pathToImage)>
<cfset imgFile.getImage()>
<cfset imgWidth = imgFile.getIconWidth()>
<cfset imgHeight = imgFile.getIconHeight()>

pathToImage should be the absolute path to the image.

Credit goes to Massimo Foti on this one...

chris



>-----Original Message-----
>From: Les Mizzell [mailto:[EMAIL PROTECTED]
>Sent: Friday, April 04, 2003 8:37 PM
>To: CF-Talk
>Subject: Get the size of an image
>
>I've got a data-driven photo gallery on a site that's working pretty good,
>but I'd like to be able to dynamically switch between two or three
>different
>layouts, dependant on the pixel width or height of an image called from the
>database, which has the link ("myimage.jpg") in it. What I'm trying to do:
>Images up to 300 pixels wide would have text descriptions to the right or
>left. Images over 300 would have the text top/bottom instead...
>
>Does anybody have any pointers to a method to dynamically determine the
>width of an image, which I can then use in a cfswitch to call the
>appropriate layout?
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to