How do you clean up the images, this is a concern as the web space is
limited. And uuid files would mean more disk space. So there must be a
way to do this with out saving as a temp file first!

Can anyone explain to me why this doesn't work, so that I can find a
solution to this?


-----Original Message-----
From: Sicular, Alexander [mailto:[EMAIL PROTECTED]] 
Sent: Friday, 15 March 2002 12:22 AM
To: CF-Talk
Subject: RE: Image and DB Solution needed

How are you storing the image in the db? As binary or string? Either way
cfcontent needs a file, so take query.test, write to file and then read
the
file back as action=readbinary then use that var in the cfoutput.

Some code I use

<cfquery name="getBinaryData" datasource="#dsn#">
SELECT binaryString, dataExtension
FROM binaryData
WHERE objectID = #url.objectID#
AND uuid = '#url.uuid#'
</cfquery>

<cfset path = "d:\temp\">

<cfset thisfilename = path & "id_" & url.objectID & "-" & url.uuid & "."
&
getBinaryData.dataExtension >

<cfset tobin = tobinary(getBinaryData.binaryString)>

<cfif fileexists(thisfilename)>
<cffile action="DELETE" file="#thisfilename#">
</cfif>
<cffile action="WRITE" file="#thisfilename#" output="#tobin#"
addnewline="No">

<cfset contenttype = "image/" & getBinaryData.dataExtension >

<cfcontent file="#thisfilename#" type="#contenttype#">


I store the image as base64 encoded text in a text column in the db. On
the
way out I transfer it back to binary. I really would like cf to let me
do
this without writing a file to disc, but alas... No dice. Maybe in neo.

Good luck,

Alexander Sicular
Chief Technology Architect
Neurological Institute of New York
Columbia University
as867 [at] columbia {dot} edu


______________________________________________________________________
Why Share?
  Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to