问题描述
这将在浏览器中显示图像:
This will show me the image in a browser:
<cfset myImage=ImageNew("d:UploadedDocuments humbnails1487862_page_1.jpg")>
<cfimage source="#myImage#" action="writeToBrowser">
但如果我在 .pdf 文件中使用相同的代码,它会生成一个小的红色 x.这不可能吗?
But if I use the same code inside of a .pdf file, it generates a small red x. Is this not possible to do?
推荐答案
如果图像已经在驱动器上,则此处不需要 CFIMAGE.你可以像这样嵌入它:
If the image is already on the drive you don't need CFIMAGE here. You can embed it like so:
<img src="file:///d:mysiteimagesmyimage.jpg" width="50" height="60">
您也可以使用它的 HTTP 路径 - 将其存储在您的 Web 服务器可通过真实或虚拟目录访问的位置,使用 <img>
标记,就像您通常那样.
You could also use an HTTP Path to it as well - store it at a location accessible by your web server through real or virtual directories use the <img>
tag like you normally would.
cfdocument 和 SSL 上的这篇文章和这个将文件系统与 cfdocument 一起使用的补充帖子应该会有所帮助你把它整理出来.
This post on cfdocument and SSL and this suplimental post on using the file system with cfdocument should help you sort it out.
这篇关于如何将本地驱动器中的图像放入 cfdocument 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!