another possibility to resolve the old php-code-in-image-problem is the usage of fileinfo and the imagecreatefromXXX-functions().
Fileinfo (get it from http://pecl.php.net/package/Fileinfo) is a libmagic related PHP-Extension. It will determine the filetype through content-analysis. The only thing you need is a mime.magic-file (eg the apache will come with one). So the initialisation is simple:
[Hint: Here I'll use the OOP-Version of fileinfo, there are also "classical" functions available. Look at http://www.php.net/manual/en/ref.fileinfo.php]
$ftype now contains the mime-type, such as image/gif, text/plain, application/octet-stream or whatever. Now the second step to remove the PHP code from a image is very simple: Use the imagecreatefrom-functions.
If you have - for example - a gif image with PHP code in it, you can use imagecreatefromgif() to create another gif-file. You can create the second one with the first one as base, then convert it to a png and this one back to gif: