LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-15-2005, 12:31 PM   #1
Locura
Member
 
Registered: May 2003
Distribution: Ubuntu 6.10 SE, Mac OS 10.4.8
Posts: 370

Rep: Reputation: 30
Coldfusion - getting image dimensions


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?
 
Old 02-15-2005, 01:06 PM   #2
Locura
Member
 
Registered: May 2003
Distribution: Ubuntu 6.10 SE, Mac OS 10.4.8
Posts: 370

Original Poster
Rep: Reputation: 30
An update: I tried using a cfdump to see the contents of the toolkit variable tk. This cfdump actually generated a "Java bean access" error. Googling that proved fruitless.
 
Old 02-15-2005, 04:52 PM   #3
Locura
Member
 
Registered: May 2003
Distribution: Ubuntu 6.10 SE, Mac OS 10.4.8
Posts: 370

Original Poster
Rep: Reputation: 30
Did some more googling, and found the following custom tag for ColdFusion. Works excellently.

http://cfdev.iamserious.com.au/index.htm
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
need video dimensions shanenin Programming 6 11-21-2005 06:54 PM
aspect ratios dimensions, not adding up shanenin Linux - Software 1 08-01-2005 03:15 PM
Saving Konqueror's dimensions in KDE iliks Linux - Software 2 07-03-2004 12:20 AM
Java arrays and dimensions pycoucou Programming 5 04-07-2004 01:59 PM
terminal dimensions and lilo nautilus_1987 Linux - General 1 10-22-2003 01:20 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration