Login
Search
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,
Reply
 
Thread Tools Display Modes
  #1  
Old 05-07-2008, 07:52 AM
lambschnitzel lambschnitzel is offline
Junior Member
 
Join Date: May 2008
Posts: 1
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2  
Old 05-07-2008, 07:52 AM
dhvrm dhvrm is offline
Member
 
Join Date: May 2008
Posts: 71
Default

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>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Your Ad Here

All times are GMT. The time now is 10:05 AM.