In article <[EMAIL PROTECTED]> ,
[EMAIL PROTECTED] (Brandon) wrote:
>I would like to store a jpg/gif image in a MySQL database (as a BLOB type I
>guess ;p), how would I output that into an <img src=""> in php?
You wouldn't, really.
You would do something like this:
<IMG SRC=fakeoutbrowser.php/image.gif?image_id=42 ...>
Then, the PHP code in fakeoutbrowser.php would look like:
$query = "select imagedata from images where image_id = $image_id";
$image = mysql_query($query) or error_log(mysql_error()); # Check HTTP log
$image_data = @mysql_result($image, 0, 0);
I *highly* recommend you *NOT* actually do this. Images will simply clog up
your MySQL database, risk db-corruption, and slow down your MySQL data
transfers to *NO* benefit.
Unless you are the CIA doing high-end image-comparison in SQL to actually
detect if two images "look alike" there's *NO* benefit to cramming your
images into an SQL database.
Far, far better to store them in a high-performance, customized, optimized,
much-used data store commonly known as "the file system" :-)
Just throw the images in a directory (possibly *outside* your web-tree) and
use PHP/MySQL to authorize access, and even use PHP to http://php.net/fread
the file, but not actually cram it into MySQL.
Like Music? http://l-i-e.com/artists.htm
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php