OK Chad...you asked for it ;-)

  <!---(Function: FileSize)------------------------------------------------------
  Date Created:   March 12, 2004
  Author:         Phil
  Arguments:      FileLoc - full path of file (string) required
  Purpose:        Gets the size of a file in bytes
  Returns:        File Size in bytes (numeric)
  --->
  <cffunction name="FileSize" returnType="numeric" access="public">
   
    <cfargument name="FileLoc" type="string" required="Yes">

    <cfset jFileIn = CreateObject("java","java.io.File").init(ARGUMENTS.FileLoc)>
    <cfreturn jFileIn.Length()>
   
  </cffunction>
  

  <!---(Function: ImageSize)------------------------------------------------------
  Date Created:   November 28, 2003
  Author:         Bryan
  Arguments:      FileLoc - full path of image to get details for (string) required
  Purpose:        returns file width/height
  Returns:        ImageInfo structure with ImgWidth/ImgHeight keys
  --->
  <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>

Hope those do the trick for ya ;-)

Cheers

Bryan Stevenson B.Comm.
VP & Director of E-Commerce Development
Electric Edge Systems Group Inc.
phone: 250.480.0642
fax: 250.480.1264
cell: 250.920.8830
e-mail: [EMAIL PROTECTED]
web: www.electricedgesystems.com

  ----- Original Message -----
  From: Chad McCue
  To: CF-Talk
  Sent: Wednesday, September 01, 2004 9:54 AM
  Subject: Re: Image size

  Yes to both of those, would love to see that function.
    ----- Original Message -----
    From: Bryan Stevenson
    To: CF-Talk
    Sent: Wednesday, September 01, 2004 12:49 PM
    Subject: Re: Image size

    Yep....if you use CFCs and CF MX I can send ya a function that uses Java to find the file dimensions and file size

    Let me know

    Cheers

    Bryan Stevenson B.Comm.
    VP & Director of E-Commerce Development
    Electric Edge Systems Group Inc.
    phone: 250.480.0642
    fax: 250.480.1264
    cell: 250.920.8830
    e-mail: [EMAIL PROTECTED]
    web: www.electricedgesystems.com

      ----- Original Message -----
      From: Chad McCue
      To: CF-Talk
      Sent: Wednesday, September 01, 2004 9:47 AM
      Subject: Image size

      Does anyone know a way to get the width and height of an image when it is upload.
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

Reply via email to