Kindly, and with respect to everyone that replied:
1. As I stated, the goal is to reduce http requests, not file sizes.
And "this is an experiment," please forgive, but the "Why" of why I
want to do this is not part of the answer.
2. Don't really need a discussion about the database design or
benefits of A or B
3. Looking for an answer to the question - How to get image in DB,
image out of DB, using CF and MySQL?
Any takers for that?
_____________
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
___________________________________
On Jan 18, 2007, at 10:32 AM, Teddy Payne wrote:
This seems to be asked often about images and BLOBs. I know you
are testing an idea out and maybe you can get it to work somehow,
but from a data perspective you just don't want to use a BLOB.
There is only one technique to reduce up front cost of a BLOB and
that is to have a BLOB table. The table would not be a part of the
primary table, so you would not intefere with indexing and
collation. You would have a normalized table with a foreign key
that you would only use for that web service.
Now for the webservice, wouldn't you want to return the lowest
common denomenator of data? If you are returning HTML or something
that needs to reference the image, it is acceptable to have a
reference with an absolute URL back to your server. The benefit
here is that the web service is consumed quicker, but the page load
would be based on the network retrieving the data.
In addition, you would want inside of your web service a way not to
return the image that would even speed up the browsing unless the
user really wants the image.
Teddy
On 1/18/07, Fennell, Mark P. <[EMAIL PROTECTED]> wrote:
I'm just curious. What are the benefits of storing the image in the
db rather than storing the file on the filesystem and the path in
the db? I mean, for a web page, all you need is the <img> and the
path. I can understand how it might be useful in some VB or C or
Java app where the client doesn't display images with such ease,
but for a web app...? Thanks.
mf
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of John Mason
Sent: Thursday, January 18, 2007 10:16 AM
To: [email protected]
Subject: RE: [ACFUG Discuss] Image from DB
I believe there would still be three http requests here. The images
would still be called up in the html like <img src=""> right? Sorry
but in http that would still create seperate http requests.
John
[EMAIL PROTECTED]
From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED] On Behalf Of
Derrick Peavy
Sent: Thursday, January 18, 2007 9:35 AM
To: [email protected]
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 FusionLink
-------------------------------------------------------------
-------------------------------------------------------------
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 FusionLink
-------------------------------------------------------------
--
<cf_payne />
Adobe Certified ColdFusion MX 7 Developer
Atlanta CFUG (ACFUG): http://www.acfug.org
-------------------------------------------------------------
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 FusionLink
-------------------------------------------------------------