copy image from database
| From: | Jan Grafström | Date: | Sat, 08 Dec 2001 08:28:46 +0000 |
| Subject: | copy image from database | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-77104@lists.php.net to get a copy of this message | ||
Hi!
I have images in my DB and want to write them to disk. I tried to copy but
nothing happend,
the image only pops up in my browser with "echo". I want it saved in a
directory on my server.
-----
$query = "select bin_data,filetype from $table where id=$id";
$result = @MYSQL_QUERY($query);
$image = @MYSQL_RESULT($result,0,"bin_data");
echo $image;
$destfile="image.jpg";
copy($image,$destfile)
-----
Thanks for any help
Regards,
Jan
--
Jan Grafström
Lillemans Hus AB
Sweden
46 (0)611-60920
46 (0)70-6409073