Re: Writing a GIF/JPG Image
| From: | Rasmus Lerdorf | Date: | Sat, 29 Jun 2002 00:08:55 +0000 |
| Subject: | Re: Writing a GIF/JPG Image | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-104442@lists.php.net to get a copy of this message | ||
You wouldn't. You would write a script like fetch_image.php in which you
would do the mysql_query() and simply echo out the image data. Then in
your main HTML file you would use:
<img src="fetch_image.php">
You can pass information to this script either via GET-method args. eg.
<img src="fetch_image.php?id=123">
Or cooler would be to do an Apache ForceType to the PHP mime type on a
file named "images" in your doc_root and put the fetch image code into
thise images file. Then use:
<img src="/images/123.jpg">
And in your "images" script you would pick the image name out of
$PATH_INFO and do the appropriate mysql query.
-Rasmus
On Fri, 28 Jun 2002, 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?
>
> Thanks in advance,
> brandon
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>