View Single Post
Old Jan 1st, 2006, 10:41 PM   #6
para
Programmer
 
Join Date: Dec 2005
Posts: 65
Rep Power: 3 para is on a distinguished road
Quote:
Originally Posted by Sane
But how does the image target run a php script?

And I could still use Python much more easily the way I mentioned.
I made one of these in PHP.
http://doommod.sourceforge.net/michael.png

First make the PHP script, start out by explicitly defining the output header:
<?php
header("Content-type: image/png");
Then go on to use ImageCreate() and related functions to generate the image data, and write it with ImagePng() [full docs on php.net].

Once your script is complete (ie, you can go to http://www.blah.com/yourscript.php and have it output the image), you can use Apache's modRewrite to modify incoming HTTP requests to reroute yourscript.png to yourscript.php internally. It will appear to others as if it's a valid static image file, but of course it's not
para is offline   Reply With Quote