Here's the function I made out of Massimo's CFC:

  <cffunction name="ImageSize" returnType="struct" access="public">
   
    <cfargument name="FileLoc" type="string" required="Yes">  
     
    <cfset jFileIn =createObject("java","java.io.File").init(ARGUMENTS.FileLoc)>
         
    <cfset ImageInfo = StructNew()>
    <cfset ImageObject = createObject("java","javax.imageio.ImageIO").read(jFileIn)>
   
    <cfset ImageInfo.ImgWidth = ImageObject.getWidth()>
    <cfset ImageInfo.ImgHeight = ImageObject.getHeight()>
   
    <cfreturn ImageInfo>

  </cffunction>

Here's how I call it:

      <cfinvoke
        component="components.utility"
        method="ImageSize"
        FileLoc="#REQUEST.PhotoDir##cffile.serverFile#"
        returnvariable="ImageInfo"
      >

REQUEST.PhotoDir:
An absolute path on the server to the file directory with a trailing slash (D:www\photos\).

CFFILE.ServerFile:
Name of file just uploaded (i.e. MyPhoto.jpg)

Hope that gets ya goin ;-)

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: Ubqtous
  To: CF-Talk
  Sent: Monday, December 01, 2003 2:14 PM
  Subject: Re: CFFUNCTION - Any thoughts??

  Bryan,

  On 12/1/2003 at 16:50, you wrote:

  BS> I'm a total Java neophyte...it works...I'm happy ;-)

  :)

  Would you mind posting the code you use to call the CFC? You're the
  first person I've talked to who has successfully run this CFC on a
  server configuration similar to my own; I'm pretty sure my code is at
  fault.

  ~ Ubqtous ~
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to