Roland,

Thank you! The only problem is that i don't always have access to the
classes directory on shared hosting. Would it work to place ImageInfo.class
in a mapped directory? In the custom tag path? Somewhere else? Is there a
way to set Java class paths via the Service Factory, like you can set DSNs?
Newbie questions, but that's where i am today!

nando :)



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Roland Collins
Sent: Wednesday, September 01, 2004 6:26 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] Using a Java class in CF to get image width and
heig ht


Here you go - I threw together a CFC wrapper for the ImageInfo java class
for you.  Drop the ImageInfo.class file in your
\CFusionMX\wwwroot\WEB-INF\classes directory, then drop the ImageInfo.cfc
wherever you want.  You can get the information as follows:

<CFSCRIPT>
ii = createObject("component", "ImageInfo");
stProperties = ii.getImageInfo("c:\tese.gif");
</CFSCRIPT>

<CFDUMP VAR="#stProperties#">

Hope this helps!

Roland.

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

Precia,

http://www.geocities.com/marcoschmidt.geo/image-info.html

Well, this is the only one i've found, but as a Java newbie, i don't see how
to implement it via CF directly - as you have done with the
javax.swing.ImageIcon approach. I'd have to sit with it for a few days to
distill the essential functions from this class, see how they work, and try
and implement them via CF. But it seems it should work.

I've also found the same technique used in PHP and VB examples, read the
first few bytes and extract the height and width information from the
header.

In any case, i think it would be very useful to refine this for CF, as it's
probably the most commonly needed use of Java in CF.

:) nando

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


Nando

I'm still on the lookout for an SWF solution.  Good luck if you find one
before me.

Precia

----- Original Message -----
From: "Nando" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 01, 2004 8:44 AM
Subject: RE: [CFCDev] Using a Java class in CF to get image width and heig
ht


> 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]
>

----------------------------------------------------------
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]


----------------------------------------------------------
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