I'm not sure you can even read the files info remotely over http. Could you
just save it to the local server to a temp dir long enough to get the info
you need?

-----Original Message-----
From: Chad McCue [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 22, 2004 8:50 AM
To: CF-Talk
Subject: Using Java to Get Image Sizes

I have the following function that produces the image width and height. The
function works perfectly when the FileLoc argument has a  directory value
from my local server, but I get the following error:

 Can't read input file!  
     
        
      The error occurred in
D:\Inetpub\wwwroot\sitename\FunctionPages\admin\ProductManager.cfc: line 711
     
709 :          
710 :           <cfset ImageInfo = StructNew()>
711 :           <cfset ImageObject =
createObject("java","javax.imageio.ImageIO").read(jFileIn)>
712 :     
713 : 


 when I try to read an image from another server with the FileLoc argument
having the following value http://www.sitename.com/images/imagename.jpg.


<cffunction name="ProductImageSize" 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>





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Protect your mail server with built in anti-virus protection. It's not only good for 
you, it's good for everybody.
http://www.houseoffusion.com/banners/view.cfm?bannerid=39

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:182309
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to