Here's a simple, useful example.

<cfscript>
function bhimginfo(imgfile){
        jFileIn = createObject("java","java.io.File").init(imgfile);
        ImageInfo = StructNew();
        ImageObject =
createObject("java","javax.imageio.ImageIO").read(jFileIn);

        imageFile = CreateObject("java", "java.io.File"); 
        imageFile.init(imgfile); 
        sizeb = imageFile.length(); 
        sizekb = numberformat(sizeb / 1024, "999999999.99");
        sizemb = numberformat(sizekb / 1024, "99999999.99");
        
        bhImageInfo = StructNew();
        bhImageInfo.ImgWidth = ImageObject.getWidth();
        bhImageInfo.ImgHeight = ImageObject.getHeight();
        bhImageInfo.SizeB = sizeb;
        bhImageInfo.SizeKB = sizekb;
        bhImageInfo.SizeMB = sizemb;
}
</cfscript>


It will return image width, height, filesize (in bytes, kilobytes, and
megabytes)


-----Original Message-----
From: DRE [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, November 08, 2006 11:29 AM
To: CF-Talk
Subject: Re: Cool things about cf

Ben,
I've instantiated java before using cf but its not been all that simple.
What would be a good example of a simple but very useful java instantiation
suitable for a tutorial?

DRE

On 11/8/06, Ben Nadel <[EMAIL PROTECTED]> wrote:
>
> I looked through the other responses, and I might have missed it, but
> the ability to instantiate Java objects, call underlying Java methods,
> and write your own Java classes... That's pretty freakin' nifty.
>
>
> ......................
> Ben Nadel
> Certified Advanced ColdFusion MX7 Developer
> www.bennadel.com
>
> Need ColdFusion Help?
> www.bennadel.com/ask-ben/
>
> -----Original Message-----
> From: DRE [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, November 07, 2006 7:01 PM
> To: CF-Talk
> Subject: Cool things about cf
>
> Hey, I'm writing a short article about the cool things that cf comes
> with that most others dont. I've got so far:
>
> qoq
> groupd output (Hey, I think its cool)
> charting
> cfdocument
>
> I'm thinking of adding a section on custom tags but not cfc's because
> you can write classes easily in most other languages.  Flash forms seem
> mostly annoying and I dont like cfform all that much.
>
> So, stuff that is very useful but only comes with cf.  Any others you
> can think of?  I'm sure there is much that I have'nt thought of.
>
> Thanks for the moment.
>
> --
> DRE
> www.webmachineinc.com
> www.theanticool.com
>
>
>
>
> 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:259668
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to