Re: Fooling the client into thinking php script is .jpg
| From: | Liam MacKenzie | Date: | Mon, 11 Feb 2002 01:48:16 +0000 |
| Subject: | Re: Fooling the client into thinking php script is .jpg | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-84202@lists.php.net to get a copy of this message | ||
Add this inno the appropriate virtual-host
<Directory "/path/to/the/folder/with/the/jpg/script">
AddType application/x-httpd-php .jpg
</Directory>
This will parse all .jpg files to the PHP interpreter.
Hope that helped!
----- Original Message -----
From: "Matt Moreton" <matt@summy.co.uk>
To: <php-general@lists.php.net>
Sent: Monday, February 11, 2002 11:44 AM
Subject: [PHP] Fooling the client into thinking php script is .jpg
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?