Welcome to the iTechForums.
If this is your first visit, be sure to check out the
FAQ by clicking the link above.
You may have to
register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
To register now click here.
|
Latest Threads
Advertisements
Forum Statistics
Threads:
Posts: 2
Members:
Number of Users Online:
Welcome to our newest member, |
|
 |

05-07-2008, 07:52 AM
|
|
Junior Member
|
|
Join Date: May 2008
Posts: 1
|
|
I'm trying to access images stored in SQL in binary format using ColdFusion.?
This is the code I am using and I think I am close but it's not displaying the image.
<cfsetting enablecfoutputonly="yes">
<cfquery name="getimages" datasource='AIEnterprise'>
select imagedata from images where imageid = '1947'
</cfquery>
<cfcontent type="image/jpeg; charset=ISO-8859_1">
<cfheader name="Content-Type" value="image/jpeg">
<CFSCRIPT>
writeOutput (ToString(GetImages.imagedata ));
</cfscript>
PS: In order to get the writeOutput line to pring out semi-correctly on the screen, I had to add spaces so that is not the actual probelm in case you notice the spaces. I just did that for posting.
Thanks!
Lora
|

05-07-2008, 07:52 AM
|
|
Member
|
|
Join Date: May 2008
Posts: 71
|
|
Well, it looks like you are assigning a charset where none should be applied (this is a binary stream, not a JPG) and you're converting to a string your binary stream (again, it's not a string).
<cfsetting enablecfoutputonly="yes">
<cfquery name="getimages" datasource='AIEnterprise'>
select imagedata from images where imageid = '1947'
</cfquery>
<cfcontent type="image/jpeg">
<cfheader name="Content-type" value="image/jpeg">
<cfheader name="Content-Type" value="image/jpeg">
<cfoutput query="getimages">
#imagedata#
</cfoutput>
|
 |
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
All times are GMT. The time now is 10:05 AM.