And the point of doing this is? 

You wouldn't be saving any real bandwidth by doing it in a single request. 
The size of the data is the size of the data, regardless of the number of 
requests. You'd just be saving requests. 


Shawn Gorrell
Web Development Applications Architect
Federal Reserve Bank - Atlanta
Office (404)  498-8449



Derrick Peavy <[EMAIL PROTECTED]> 
Sent by: [EMAIL PROTECTED]
01/18/2007 09:34 AM
Please respond to
[email protected]


To
[email protected]
cc

Subject
[ACFUG Discuss] Image from DB






Probably an easy problem for someone...

I want to put two small images in my database and then output them in my 
app, so that they do not constitute additional http requests. Consider it 
an experiment - I know that it may seem a bit silly.  The goal is for the 
entire page to be delivered to the browser in one http request, instead of 
3 (two images and one cf page) without doing any Apache tinkering.  I have 
looked around the net for answers and cannot seem to make this work. 

Database field is "imageFile" of type BLOB in MySQL 4.1.13.  What is the 
proper way to insert the image? 

Example: INSERT into Images (imageFile) values ('#base64(image)#')
-Or-
Example: INSERT into Images (imageFile) values ('#image#')

And then of course, how do you retrieve it?  Example: SELECT imageFile 
FROM Images WHERE imageID=1

<cfoutput>
#toString(imageFile)#
</cfoutput>
-OR-
<cfoutput>
#toBinary(imageFile)#
</cfoutput>

As I say, I've not been able to make this work. If I use toString(), I 
simply get the raw data. If I use toBinary(), I get an error that the data 
cannot be converted to a string. Also, using CFCONTENT is fine to output 
the image, but then any code after that is ignored. So, short of saving 
the entire page and then outputting, it, I don't see a way to use 
CFCONTENT.

_____________ 
Derrick Peavy
Sales and Web Services 
Universal Advertising
Phone: 404-786-5036
Fax: 404-370-0470 
http://www.universaladvertising.com 
http://www.collegeadvertising.com 
http://www.collegeclassifieds.com 
___________________________________






-------------------------------------------------------------
To unsubscribe from this list, manage your profile @ 
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------

Reply via email to