Re: [PHP-DB] displaying graphics From: Johan Hanson (johan <email protected>)
Date: 08/31/00

Mike Hammonds wrote:
>
> ** Reply Requested When Convenient **
>
> Anybody have a good script that will allow me to get an image from MySQL and than display it on a web page?

Here is what I do. I use Apache and mod_rewrite to let an URL like
"images/<number>.gif"
be translated into a request for "image.php?img=<number>". That way, the user
can save the
file from her browser without it mangling the file name.
The configuration directive is:

RewriteRule ^/images/(.+)\.gif$ image.php?img=$1 [L]

My script outputs the correct mime type in the headers and 'echo'es the gif file
directly.
Just make sure that you don't echo anything else than the gif file, such as a
newline
at the end of your script.
For more info, look in the file "features.images.html" in your PHP
documentation.

/ Johan
 -- johan <email protected> -- http://www.obsession.se/johan/ --

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>