Add this inno the appropriate virtual-host

<Directory "/path/to/the/folder/with/the/jpg/script">
AddType application/x-httpd-php .jpg

This will parse all .jpg files to the PHP interpreter.

Hope that helped!

----- Original Message -----
From: "Matt Moreton" <[EMAIL PROTECTED]>
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:

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?

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?

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to