curious one this.
I'm working on a process that generates PDF files, combining data from various sources. The last piece of this process I need to complete is merging in image files.
This is actually fairly straightforward but the problem I have is the image files aren't stored with file extensions. Locally, I can change the filename, but in production this isn't an option.
So because a filename looks like : B71637CB-A49C-0653-EF813918736BDEB7
This will not work:
<cfimage action="writeTobrowser" source="#FilePath#>
Same with
<img src="#FilePath#">.
So, any ideas on how I can work around this? Here's the code in context:
<cfdocument format="PDF" name="report" filename="#fileToDownloadimage#" overwrite="yes">
<cfdocumentsection>
<cfimage action="writeTobrowser" source="#FilePath#.jpg">
</cfdocumentsection>
</cfdocument>
If you need to embed the images into the PDF document, try HTML's inline image capabilities:
You can try creating a cfm page that outputs your content using cfcontent as in:
Then you would you include THAT cfm page as the source for your image as in
This should work but it may require some trial and error. :)
Ray has some additional tips here:
http://www.raymondcamden.com/2007/09/14/Serving-up-CFIMages-via-Image-Tags-and-a-NonCF-Friday-contest
So here's what ended up working:
Alex's answer got me down the right path so I'm perfectly happy to leave the kudos in place, cos I wasn't getting anywhere near this!