grrrrrr....but it doesn't work on Linux!!

Here's the error while thumbnailing:

      This graphics environment can be used only in the software emulation mode.  
     
        
      The error occurred in /var/www/pmcfcs/utility.cfc: line 100
     
98 : <cfset temp = jTransform.Scale(Scale, Scale)>     
99 : <!--- initialize a Graphics2D object --->
100 : <cfset jGraphics2D = outBufferedImg.createGraphics()>
101 : <!--- draw the thumbnail --->
102 : <cfset temp = jGraphics2D.drawRenderedImage(inBufferedImg, jTransform)>I'm not entirely sure what's wrong here....anybody have any ideas what is needed to get into "software emulation mode"??ThanksPS....function below:  <cffunction name="ThumbIt" access="public">        <cfargument name="FileLoc" type="string" required="Yes">           <cfset jFileIn = createObject("java","java.io.File").init(ARGUMENTS.FileLoc)>         <!--- build new file loc and name --->   <cfset DirPath = GetDirectoryFromPath(ARGUMENTS.FileLoc)>   <cfset FileName = GetFileFromPath(ARGUMENTS.FileLoc)>      <cfset ThumbFileLoc = DirPath & "thumb_" & FileName>          <cfset jFileOut = createObject("java","java.io.File").init(ThumbFileLoc)>    <!--- set dimiensions --->    <cfset inBufferedImg = createObject("java","javax.imageio.ImageIO").read(jFileIn)>      <cfset ImgWidth = inBufferedImg.getWidth()>    <cfset ImgHeight = inBufferedImg.getHeight()>  <!--- calculate scale --->  <cfset Scale = 420 / ImgWidth>      <!--- define thumbnail dimensions --->  <cfset ScaledWidth = (Scale * ImgWidth)>    <cfset ScaledHeight = (Scale * ImgHeight)>      <!--- create image output --->  <cfset outBufferedImg = createObject("java","java.awt.image.BufferedImage").init(JavaCast("int", ScaledWidth), JavaCast("int", ScaledHeight), JavaCast("int", 1))>      <!--- create the AffineTransform --->  <cfset jTransform = createObject("java","java.awt.geom.AffineTransform").init()>     <cfset temp = jTransform.Scale(Scale, Scale)>       <!--- initialize a Graphics2D object --->  <cfset jGraphics2D = outBufferedImg.createGraphics()>  <!--- draw the thumbnail --->  <cfset temp = jGraphics2D.drawRenderedImage(inBufferedImg, jTransform)>  <cfset temp = jGraphics2D.dispose()>   <!--- write the thumbnail image to disk --->  <cfset fileWritten = createObject("java","javax.imageio.ImageIO").write(outBufferedImg, "jpg", jFileOut)>  </cffunction>  

Bryan Stevenson B.Comm.
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
t. 250.920.8830
e. [EMAIL PROTECTED]

---------------------------------------------------------
Macromedia Associate Partner
www.macromedia.com
---------------------------------------------------------
Vancouver Island ColdFusion Users Group
Founder & Director
www.cfug-vancouverisland.com
  ----- Original Message -----
  From: Bryan Stevenson
  To: CF-Talk
  Sent: Monday, December 01, 2003 2:32 PM
  Subject: Re: CFFUNCTION - Any thoughts??

  Hey Massimo,

  I've stripped down your thumbnail code into my own function and I'm getting an error on the last line:

  <cfset fileWritten = createObject("java","javax.imageio.ImageIO").write(outBufferedImg, "jpg", jFileOut)>

  The error is:
        The selected method write was not found.  
        Either there are no methods with the specified method name and argument types, or the method write is overloaded with arguments types that ColdFusion can't decipher reliably. If this is a Java object and you verified that the method exists, you may need to use the javacast function to reduce ambiguity.  

  Here's the function as it stands now:

    <cffunction name="ThumbIt" access="public">
      
      <cfargument name="FileLoc" type="string" required="Yes">  
      
      <cfset jFileIn = createObject("java","java.io.File").init(ARGUMENTS.FileLoc)>
      
      <!--- build new file loc and name --->
     <cfset DirPath = GetDirectoryFromPath(ARGUMENTS.FileLoc)>
     <cfset FileName = GetFileFromPath(ARGUMENTS.FileLoc)>  
      <cfset jFileOut = DirPath & "thumb_" & FileName>  

      <!--- set dimiensions --->
      <cfset inBufferedImg = createObject("java","javax.imageio.ImageIO").read(jFileIn)>   
      <cfset ImgWidth = inBufferedImg.getWidth()>
      <cfset ImgHeight = inBufferedImg.getHeight()>
    <!--- calculate scale --->
    <cfset Scale = 80 / ImgWidth>   
    <!--- define thumbnail dimensions --->
    <cfset ScaledWidth = (Scale * ImgWidth)>
      <cfset ScaledHeight = (Scale * ImgHeight)>   
    <!--- create image output --->
    <cfset outBufferedImg = createObject("java","java.awt.image.BufferedImage").init(JavaCast("int", ScaledWidth), JavaCast("int", ScaledHeight), JavaCast("int", 1))>   
    <!--- create the AffineTransform --->
    <cfset jTransform = createObject("java","java.awt.geom.AffineTransform").init()>   
    <cfset temp = jTransform.Scale(Scale, Scale)>     
    <!--- initialize a Graphics2D object --->
    <cfset jGraphics2D = outBufferedImg.createGraphics()>
    <!--- draw the thumbnail --->
    <cfset temp = jGraphics2D.drawRenderedImage(inBufferedImg, jTransform)>
    <cfset temp = jGraphics2D.dispose()>
    <!--- write the thumbnail image to disk --->
    <cfset fileWritten = createObject("java","javax.imageio.ImageIO").write(outBufferedImg, "jpg", jFileOut)>

    </cffunction>

  ARGUMENTS.FileLoc = D:\www\images\photos\my_image.jpg

  I've put in breaks using cfdump/cfabort and everything seems to work just fine until writing the file??

  Thanks in advance for any insight

  Cheers

  Bryan Stevenson B.Comm.
  VP & Director of E-Commerce Development
  Electric Edge Systems Group Inc.
  t. 250.920.8830
  e. [EMAIL PROTECTED]

  ---------------------------------------------------------
  Macromedia Associate Partner
  www.macromedia.com
  ---------------------------------------------------------
  Vancouver Island ColdFusion Users Group
  Founder & Director
  www.cfug-vancouverisland.com
    ----- Original Message -----
    From: Massimo, Tiziana e Federica
    To: CF-Talk
    Sent: Saturday, November 29, 2003 12:19 AM
    Subject: Re: CFFUNCTION - Any thoughts??

    Try this CFC:

    http://www.cfmentor.com/code/index.cfm?action="">

    I never tested it on Linux, but it use the javax.imageio.ImageIO classes
    instead of Swing.

    I guess your problem are related to this:

   
http://devilm.com/archives/000050.html

    ----------------------------
    Massimo Foti
    Certified Dreamweaver MX Developer
    Certified Advanced ColdFusion MX Developer
    http://www.massimocorner.com/
    ----------------------------
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to