• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Image Data Type - One Will Output , but need full recordset

New Here ,
Aug 13, 2006 Aug 13, 2006

Copy link to clipboard

Copied

working on pulling image data types from a db.
Environment:
CF71 Standard
WIN2K3
SQL SRV 2000

There is more than one record in the database that I need to return. Any insight / extra eyes will be much appreciated.

Code That returns one record
TOPICS
Advanced techniques

Views

519

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 13, 2006 Aug 13, 2006

Copy link to clipboard

Copied

oh yeah. . . .i failed to mention that I don't want to store any images physically on disk

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 14, 2006 Aug 14, 2006

Copy link to clipboard

Copied

I don't see anything resembling a cfoutput tag or a loop of any sort.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 14, 2006 Aug 14, 2006

Copy link to clipboard

Copied

i've tried positioning cfouput and cfloop tags to no avail. Part of me wants to think it needs to loop within the cfscript tags. . . . .

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Aug 14, 2006 Aug 14, 2006

Copy link to clipboard

Copied

You can loop inside the script. You do so using the keyword for or while. Both will work. I prefer using for.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 14, 2006 Aug 14, 2006

Copy link to clipboard

Copied

I haven't worked with db-based images but I assume you have tried:

<cfsetting enablecfoutputonly="yes">
<cfquery name="qGetImage" datasource="images">
SELECT *
FROM tblphotos
WHERE
ORDER BY phname ASC
</cfquery>
<cfif qGetImage.RecordCount GT 0>
<cfoutput query="qGetImage">
<cfcontent type="image/jpeg; charset=ISO-8859-1">
<cfheader name="Content-Type" value="image/jpeg">
<cfscript>
writeOutput(ToString(phpaths));
</cfscript>
</cfoutput>
<cfelse>
This image cannot be found.
</cfif>

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 14, 2006 Aug 14, 2006

Copy link to clipboard

Copied

yes. . .i've tried every logical position that I would think(at leats) would make it click. . . .

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 14, 2006 Aug 14, 2006

Copy link to clipboard

Copied

quote:

Originally posted by: Dan Bracuk
You can loop inside the script. You do so using the keyword for or while. Both will work. I prefer using for.


that's a good idea. Last time I wrote a loop in javascript. . . .I had a dead server in need of a reboot. I'll have to safely revisit that idea. 🙂

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 17, 2006 Aug 17, 2006

Copy link to clipboard

Copied

still haven't made any progress on this . . . .anyone else have any suggestions???

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 17, 2006 Aug 17, 2006

Copy link to clipboard

Copied

LATEST

Perhaps what you're trying to do is not possible with ColdFusion?

It kind of sounds like you need two templates?

I'm not sure of the syntax or tag names but I was thinking something like this...

<!--- template 1: view_my_images.cfm --->
Pic of Dad: <img src="get_my_image.cfm?imgId=1" />
Pic of Mom: <img src="get_my_image.cfm?imgId=2" />

<!--- template 2: get_my_image.cfm --->
<cfquery name="getImage" datasource="myDSN">
SELECT image_blob FROM tblPhotos
WHERE image_id = <cfqueryparam value="#url.imgId#">
</cfquery>

<cfheader name="Content-Type" value="image/jpeg">
<cfcontent type="image/jpeg"><cfoutput>#getImage.image_blob#</cfoutput>


Good luck!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation