Tim,

I had a whole bunch of bother with this on RH7.2.

In the end I switched the JRE to Sun j2re 1.4.1_02 as you did and with the
help of a java blokie I know eventually created this.

 <cfscript>
 imageObject = CreateObject("java", "javax.imageio.ImageIO");
 fileObject = CreateObject("java", "java.io.File");
 fileObject.init(newfile);
 thisImage = imageObject.read( fileobject );
 width = thisImage.getWidth();
 height = thisImage.getHeight();
 </cfscript>

I suspect that I could cut out the java.io.File bit, by using a JavaCast to
pass the file name directly into imageObject as a string, but the above
works, so why fix something thats not broken.

Hope that helps

Regards

Stephen

----- Original Message -----
From: "Tim Blair" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, March 25, 2003 1:03 PM
Subject: RE: [ cf-dev ] Retriving image dimensions


>
> Hmm, having issues here...
>
> -----------------------------------------------------------------
> The error occurred in
> /home/dev/webs/kryten.rawnet.com/htdocs/imgtest2.cfm: line 2
>
> 1 : <cfset imageObj = createObject("java", "java.awt.Toolkit")>
> 2 : <cfset imagetools = imageObj.getDefaultToolkit()>
> 3 : <cfset objImage = imagetools.getImage("/path/to/img.gif")>
> 4 : <cfset width = objImage.getWidth()>
> -----------------------------------------------------------------
>
> Now as far as I can work out, things seem to be dying on the old
> getDefaultToolkit() method, but for what reason I don't know.  Below is
> the stack trace from the exception log, and it appears that my JVM is
> missing something?  I'm running with the default CFMX install on Linux
>
> -----------------------------------------------------------------
> java.lang.NoClassDefFoundError
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forName(Class.java:115)
>         at java.awt.Toolkit$2.run(Toolkit.java:507)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:498)
>         at java.lang.reflect.Method.invoke(Native Method)
>         at coldfusion.runtime.java.JavaProxy.invoke(Unknown Source)
>         etc ...
> -----------------------------------------------------------------
>
> Have also tried out the given info at
> http://www.benorama.com/coldfusion/libraries/imaging.htm but seem to be
> getting the same problem, at the same location (getDefaultToolkit()).
>
> I've also tried switching the JVM to a using the Sun 1.4 one, which gets
> through the problem with getDefaultToolkit() but bombs out later down
> the line:
>
> -----------------------------------------------------------------
> sun.java2d.SunGraphicsEnvironment.createFontProperties()Lsun/awt/FontPro
> perties;
>
> The error occurred in
> /home/dev/webs/kryten.rawnet.com/htdocs/imgtest2.cfm: line 2
>
> 1 : <cfset  imageObj = createObject("java", "java.awt.Toolkit")>
> 2 : <cfset  imagetools = imageObj.getDefaultToolkit()>
> 3 : <cfset  objImage= imagetools.getImage("/path/to/img.gif")>
> 4 : <cfset  width = objImage.getWidth()>
> -----------------------------------------------------------------
>
> Any suggestions?
>
> Tim.
>
>
> -------------------------------------------------------
> RAWNET LTD - Internet, New Media and ebusiness Gurus.
> Visit our new website at http://www.rawnet.com for
> more information about our company, or call us anytime
> on 01344 393 040.
> -------------------------------------------------------
> Tim Blair
> Web Application Engineer, Rawnet Limited
> Direct Phone : +44 (0) 1344 393 441
> Switchboard : +44 (0) 1344 393 040
> -------------------------------------------------------
> This message may contain information which is legally
> privileged and/or confidential.  If you are not the
> intended recipient, you are hereby notified that any
> unauthorised disclosure, copying, distribution or use
> of this information is strictly prohibited. Such
> notification notwithstanding, any comments, opinions,
> information or conclusions expressed in this message
> are those of the originator, not of rawnet limited,
> unless otherwise explicitly and independently indicated
> by an authorised representative of rawnet limited.
> -------------------------------------------------------
>
>
>
> --
> ** 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]

Reply via email to