|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
calling java class (with JMagick code) from CFML MX
Hi,
I have previously developed applications in CFML calling java classes using "<cfset createobject>". Now I have developed a Java application with JMagick and ImageMagick support. ImageMagick is a free open source Image Manipulation libraries collection. JMagick is a JNI (Java Native Interface) provided over ImageMagick. By installing ImageMagick and Jmagick, I was able to develop a Java application successfully. Now, I need to call this JAVA class from CFML, so that I can develop a CFML application for Image Processing. This is my java class; import magick.ImageInfo; import magick.MagickImage; import magick.MagickException; public class imtrail { public String execute(String filename,int x,int y) { String message = ""; ImageInfo info = null; MagickImage image1 = null; try { info = new ImageInfo(filename); image1 = new MagickImage(info); MagickImage bigger = image1.scaleImage(x,y); bigger.setFileName(filename); bigger.writeImage(info); } catch(MagickException e) { message = e.getMessage(); } return message; } } This is my CFML code: <cfset file_name = "c:\\images\\fujifilm.jpg"> <cfset x = 150> <cfset y = 150> <cfset myobject = createobject("java","imtrail")> <cfset message = myobject.execute(file_name,x,y)> <cfoutput>#message#</cfoutput> I am getting the error: Object Instantiation Exception. An exception occurred when instantiating a java object. The cause of this exception was that: magick/MagickException. The error occurred in C:\cfmltest\scale.cfm: line 4 2 : <cfset x = 150> 3 : <cfset y = 150> 4 : <cfset myobject = createobject("java","imtrail")> 5 : <cfset message = myobject.execute(file_name,x,y)> 6 : <cfoutput>#message#</cfoutput> If any one has any idea please help me Thank you in advance Kishore PRS. |
|
#2
|
|||
|
|||
|
One way to make it work...
We have run into the same problem on our sites. We make extensive use of Jmagick/ImageMagick.
I found that if you place the jmagick.jar file in the server path that the jmagick/imagemagick app will run correctly. The server path is typically C:\CFusionMX7\runtime\servers\lib on a typical server installation. I have also noticed that this problem does not present itself in a j2ee install. Think that is because all java objects are loaded from the j2ee class. |
|
#3
|
|||
|
|||
|
Quote:
Hi, I am a beginner using JMagic/ImageMagick on Coldfusion MX.. and struggling on intalling it properly on server. I got 'jmagick.dll' file downloaded from their official website. How does it work to generate 'jmagic.jar' file? . do I only need to include this file on path (configured on coldfusion MX adminstrator) setting ? Is there any other website userful in terms of instructing beginner people like me to install, configure and start using it ? Thanks a lot, and eagerly waiting for your answer. Cheers |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > calling java class (with JMagick code) from CFML MX |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|