Not Politics - A ColdFusion Image Tip

So, I’m currently working on a new application for the next DRK. I can’t say much about it (it’s code named Harlan), but I can talk about an issue I ran into. I needed a quick way to determine the height and width of an image. Normally I would use Alagad for this type of task. I really like Alagad - it’s like the Bass-O-Matic of Image tools, and the price is right. But - it’s not free, so I can’t include it in the DRK. However, I did find this nice tip by David Medlock:

<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(fname);
width = img.getWidth();
height = img.getHeight();
</cfscript>
Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments