Fooling the client into thinking php script is .jpg
| From: | Matt Moreton | Date: | Mon, 11 Feb 2002 01:44:44 +0000 |
| Subject: | Fooling the client into thinking php script is .jpg | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-84201@lists.php.net to get a copy of this message | ||
I have a script that outputs an image. Using the gd library. But the only way this script gets to
execute is if you call it like:
www.host.com/displayimage.php
That then sends the content header, and the image. Obviously I am doing some other stuff in there,
which is why I am using a script to generate the image. Is it possible somehow to request the file
as a .jpg?
www.host.com/displayimage.jpg
Fooling the client into thinking it is just a .jpg image.
I tried changing the .htaccess file for the dir this script was in, so that when a 404 error is
genterated, it redirects to the displayimage.php script. But its not exactly a transparent
redirect. If you type an invalid url it simply redirects, displaying the name of the script,
displayimage.php while loading the image.
Any suggestions please?