I'm running ColdFusion MX 6.1 on a RH server, and I would like to find a way to get an image's dimensions. I found the following
example after trying google:
Code:
<cfobject type="JAVA" action="Create" name="tk" class="java.awt.Toolkit">
<cfobject type="JAVA" action="Create" name="img" class="java.awt.Image">
<cfscript>
img = tk.getDefaultToolkit().getImage("/usr/local/apache2/htdocs/cheater.jpg");
width = img.getWidth();
height = img.getHeight();
</cfscript>
<cfoutput>#width#<br>#height#</cfoutput>
There was an error with that code, as some of the replies on that page mention. The suggested solution was to remove the parenthesis from
tk.getDefaultToolkit(). I did so, and got the following error:
Element GETDEFAULTTOOLKIT is undefined in TK
Does anyone know what's causing this, or perhaps a better way to get at the images height and width?