ColdFusion 有一个很棒的 cfimage 标签,可以完美运行。 但是,它不允许操纵矢量格式。 这导致我继续寻找第三方工具来执行一些“图像魔法”。
我决定尝试使用 ImageMagick 和 ColdFusion。 我读过几篇文章,内容是“我曾经使用 ColdFusion 的 ImageMagick 工作了 X 年”。 这很鼓舞人心,但在遇到问题时并不是特别有用。
我已尝试以下操作:
-
cfexecute 带参数运行命令行“转换”命令。 ColdFusion 页面不产生任何内容 - 只是一个空页面。 图像未转换。 没有例外,也没有文本发送到浏览器。 ImageMagick 命令“convert image.eps image.jpg”可以从 Windows 命令行完美运行,但不能从 ColdFusion 运行。
-
Im4java 和 JMagick 包装器直接从 Java 对象运行 IM 命令。 我使用 CreateObject 函数创建了 Java 对象,并尝试执行它的方法,但只得到了不同类型的 Java 错误,例如“无法将 image.jpg 转换为整数”。
欢迎任何建议。
谢谢!
PS:我的第一个“stackoverflow”:)
ColdFusion has a great cfimage tag that works perfectly. However, it doesn't allows vector formats to be manipulated. This caused me to continue searching for 3rd party tools to do some "image magic".
I decided to try ImageMagick with ColdFusion. I've read couple of posts that was saying 'I used to work with ImageMagick from ColdFusion for X years'. This is inspiring, but not particularly useful when bumping into problems.
I've tried the following:
-
cfexecute with arguments to run command-line 'convert' command. ColdFusion page produces nothing - just an empty page. Images are not converted. No exceptions or text being out to browser. ImageMagick command 'convert image.eps image.jpg' runs perfectly from Windows command line, but not from ColdFusion.
-
Im4java and JMagick wrappers to run IM commands directly from Java objects. I created Java objects with CreateObject function and was trying to execute it's methods, but got only different types of Java errors like 'cannot convert image.jpg to integer'.
Any suggestions welcome.
Thanks!
PS: my first 'stackoverflow' :)
发布评论
评论(3)
经过一番尝试和失败后,我让 ImageMagick (IM) 为我工作。 让我简要描述一下如何使用 Coldfusion 的 ImageMagick:
利用CFEXECUTE标签调用带参数的IM:
注释
: 在“名称”属性中写入 ImageMagic 可执行文件之一(例如,convert.exe)的完整路径。
b. 编写源图像和目标图像的完整路径。 请注意附加引号 - 如果完整路径包含空格 (C:\Program Files),则必须将每个图像名称括在引号中。 由于 Coldfusion 解析“arguments”属性,因此您必须使用附加引号来筛选引号,例如 -“”C:\Program Files\“”。
C。 使用超时属性,在 Coldfusion 进一步执行模板之前留出一些时间让 ImageMagic 生成结果。
谢谢大家的回答和兴趣。
PS:其他提示:
After some tries and fails, I made ImageMagick (IM) work for me. Let me briefly describe how to work with ImageMagick from Coldfusion:
Make use of CFEXECUTE tag to call IM with parameters:
<cfexecute name="#FullIMPath#" timeout="60" arguments="""#ExpandPath(filename1)#"" ""#ExpandPath(filename2)#""" />
Comments:
a. Write full path to one of ImageMagic executables (for example, convert.exe) in 'name' attribute.
b. Write full paths for source and target images. Please note additional quotes - if full path has spaces (C:\Program Files), you have to surround each image name in pair of quotes. Since Coldfusion parses 'arguments' attribute, you have to screen a quote with additional quote, like this - ""C:\Program Files\"".
c. Use timeout attribute, to allow some time for ImageMagic to produce results before Coldfusion goes further with template execution.
Thank you all for answers and interest.
PS: Additional hints:
cfexecute 应该可以工作。
cfexecute should work.
还要考虑 cfx_image ..它是一个激发 cfimage 灵感的优秀标签。 我相信它也可以处理矢量图像。 没有什么是我做不到的。
Also consider cfx_image .. it is an excellent tag that inspired cfimage. I believe it also does vector images. There isn't much I haven't been able to do with it.