Chris,
>I have a project where images are uploaded/saved in SQL Server. Outside of
>fusebox, I can retrieve the image in various ways and display it within my
>CFML page. Unfortunately, i'm required to use fusebox and have hit a brick
>wall.
>
>The solution I thought would help me was taking from "<a
>href="http://www.forta.com/blog/index.cfm?mode=entry&entry=A61BC976-3048-
>80A9-EF7AE4D7D8F602B9">Serving Images from Databases</a>". Except fusebox
>being fusebox, the image
>is returned broken.
>
>Has anyone dealt with this issue before? And if so, do you have any ideas
>on how I can get the image to display?
>
>(I know that saving images to a database isn't encouraged, except I don't
>have
>much choice in the matter.)
I don't use Fusebox, but a couple of tips:
* Use <cfcontent reset="true" /> to clear the output buffer. This will make
sure that any whitespace generated before the <cfcontent /> is erased.
* Use <cfabort /> to halt further execution.
So, you code should look something like:
<!--- Determine image to retrieve --->
<cfset ...>
<!--- Get image --->
<cfquery datasource="mydsn" name="image">
SELECT imageData
FROM table
WHERE ...
</cfquery>
<!--- Set MIME type to GIF or JPEG or ... --->
<cfcontent
reset="true"
variable="image.imageData"
...
/><cfabort />
Note how the <cfabort /> tag is right after the <cfcontent /> tag.
-Dan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four
times a year.
http://www.fusionauthority.com/quarterly
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:254071
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4