To read a file from a URL I think you may need to do something like this:

theUrl = "your URL";
u = createObject("java","java.net.URL").init(theUrl);
inP = createObject("java","java.io.BufferedInputStream").init(u.openStream());
ImageObject = createObject("java","javax.imageio.ImageIO").read(inP);

However I am not sure if your object requires a string or an input
stream (in the above example you are passing in an input stream ).

HTH (a little!)

G


On Fri, 22 Oct 2004 08:49:47 -0400, Chad McCue
<[EMAIL PROTECTED]> wrote:
> 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>
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Purchase from House of Fusion, a Macromedia Authorized Affiliate and support the CF 
community.
http://www.houseoffusion.com/banners/view.cfm?bannerid=34

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:182311
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to