msgbartop
News, views, tips and tricks on Oracle and other fun stuff
msgbarbottom

Writing/Reading images to/from DB

In ColdFusion it is very simple and straight forward to store and retrieve images to/from an Oracle database. Here is an example of how you can do it: Continue reading…

4 Comments | Filed in ColdFusion, Tips | Tags: ,


Get image dimensions

Here is a quick and dirty (and easy) way to get the width and height of an image. It should work for both JPG and GIF files:

<cfobject type="JAVA" action="Create" name="tk" 
          class="java.awt.Toolkit">
</cfobject>
<cfobject type="JAVA" action="Create" name="img" 
          class="java.awt.Image">
</cfobject>
<cfscript>
img = tk.getDefaultToolkit().getImage("c:\img.gif");
width = img.getWidth();
height = img.getHeight();
</cfscript>
<cfoutput>#width#<br />#height#</cfoutput>

That’s the beauty of ColdFusion, you have all of the Java language available to you right out of the box. ColdFusion is after all a Java application behind the scene.

source

29 Comments | Filed in ColdFusion | Tags: ,