Don't use AWT, use JAI

-----Original Message-----
From: Stephen Moretti [mailto:[EMAIL PROTECTED] 
Sent: 04 February 2004 15:41
To: [EMAIL PROTECTED]
Subject: [ cf-dev ] java image manipulation on RH7.2


How do I get myself into these situations???!!!

I've got some code that accesses various java objects to resize images. 
  It all seems about right, but I'm getting:

"This graphics environment can be used only in the software emulation mode"

Now I know that this is related to the server being a "headless" graphic 
environment and have seen the MM article : 
http://www.macromedia.com/support/coldfusion/ts/documents/graphics_unix_141jvm.htm#
and made the appropriate changes to the jvm.config

Thing is I'm still getting the same error.  If anyone has any ideas why 
this might be I'd appreciate the help.

The box is running cfmx6.1 on RH 7.2 using Sun JVM 1.4.2-b28

The code for the image manipulation is below.  Let me know if I've 
knacked something....

TIA

Stephen

<cfscript>
newfile = variables.profileimagepath&CFFile.ServerFile;
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(); if (width gt variables.imagewidth) {
        scale = height/width;
        newheight = variables.imagewidth*scale;
        BufferedImage = CreateObject("java","java.awt.image.BufferedImage");           
 
        BufferedImage.init(JavaCast("int",variables.imagewidth), 
JavaCast("int", newheight), JavaCast("int", 1));
        geoAffTransform = createObject("java","java.awt.geom.AffineTransform");
        geoAffTransform.init();
        geoAffTransform.scale(scale, scale);
        newimage = BufferedImage.createGraphics();
         newimage.drawRenderedImage(thisImage, geoAffTransform);
         newimage.dispose(); 
outputfile=fileObject.init("#variables.profileimagepath##request.LoggedIn#.jpeg");
         imageObject.write(newimage, "jpeg", outputfile);
}
</cfscript>

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