Hehe I love questions like these.

This is the wrong list for these types of questions; you want
[EMAIL PROTECTED]  This list is about developing PHP not
developing WITH PHP.

Anyways, short answer is in an HTML document when the browser comes to
an IMG tag it makes another HTTP request to the server for that file.
So what you need to do it make a file that just displays the content of
the image.

Example.

Image.php
<?php

// do DB stuff get image data then print this
header("Content-type: image/png"); // or whatever format it is can use
application/octet-stream if unsure print $image_contents;

?>

That's it...then from your html page

<img src="Image.php?id=image_id">

-Chris

-----Original Message-----
From: Christofe DuBois [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, December 06, 2001 5:11 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DEV] Help displaying an image stoed in a MySQL database

I would like to store an image in a database and then allow users to
select
the image for display...

I can upload the file, and write it to the database.  I base64_encode '
d it
and dropped it in a longblob field.

I then query the database, pull the encoded image out...  now what...

I have tried simply saying <img src=$encoded_var> and that doesn't work
worth squat...

So basically, I have:

HTML

HTML

HTML
HTML
HTML

Image to display here

HTML
HTML

HTML


How do I get the image to pull from the database and display there in
the
middle of all the HTML?

-Chris






-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to