> Try this code. It assumes you are already connected to the database. > Usually, I put that script in something like database.inc and just do an > include. > > <?php > mysql_connect ("mysql_server", "username", "password"); > mysql_select_db("database_name"); > $sql = mysql_query("SELECT image, type FROM table_name WHERE pid='$id'"); > $file = mysql_fetch_row($sql); > header("Content-type: $file[1]"); > echo $file[0]; > ?> > > pid is the picture id. I'll assume you'll have an index or something in your > database setup. > Now, type is based on the extension of the file really. If filename.gif is > uploaded, it is assumed that the header type is image/gif. > > How do you use this? > > Save this little script as a seperate file. It is now the image file. > Observe: > <img src="foobar.php?id=24"> > > Now, assuming that the file you saved it as is foobar.php, the script will > fetch the binary data of whatever is at pid 24. >
It doesn't run for me. I always got an eternal red cross in place of the picture I'm looking for...Any idea ? ---------------------------------- Stéphane Pinel 39, Rue du Docteur Heulin 75017 Paris (FRANCE) 33 1 53 11 05 77 33 6 08 94 63 16 [EMAIL PROTECTED] ---------------------------------- -- PHP General 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]