As a note, if you can use .htaccess you can 'force' a file to a php script, so rename your php file to something.jpg (replace something with whatever you want), and add this to your .htaccess
<Files something.jpg>
ForceType application/x-httpd-php
</Files>
I just tested that, and it seems to work
