Precia,

thanks for the code snippet - and the example of using java within CF - it
works very well, for images. It's much faster than using the approach Craig
indicated, via java.io.File and javax.imageio.ImageIO, or the Alagad
component. I wonder if that's because javax.swing.ImageIcon just grabs the
file header? Unfortunately it doesn't work for SWFs, but because the code is
so clean, i'm thinking to use it for the images anyway and work out a
specialized solution for the SWFs

Thanks again,

:) nando

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Precia Carraway
Sent: Wednesday, September 01, 2004 10:16 AM
To: [EMAIL PROTECTED]
Subject: Re: [CFCDev] Using a Java class in CF to get image width and
heig ht


<cfscript>
 function getImageWidth(imagepath)
 {
  imgFile = createObject("java","javax.swing.ImageIcon").init(imagepath);
  imgFile.getImage();
  imgWidth = imgFile.getIconWidth();
  return imgWidth;
 }
 function getImageHeight(imagepath)
 {
  imgFile = createObject("java","javax.swing.ImageIcon").init(imagepath);
  imgFile.getImage();
  imgWidth = imgFile.getIconHeight();
  return imgWidth;
 }
</cfscript>


#getImageWidth(attributes.filepath)#
#getImageHeight(attributes.filepath)#


Hope this helps...
PCC

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev'
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at
www.mail-archive.com/[EMAIL PROTECTED]


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to