slpctrl Posted September 12, 2009 Share Posted September 12, 2009 Alright, I've got this simple little script here: <?php //draws the image and stuff. . . $im = @imagecreatefrompng( "babe.png" ); header( "Content-type: image/png" ); imagepng($im); imagedestroy($im); ?> This works fine when it's saved as a .php, but when I save it as a .gif file (and this is my .htaccess: AddHandler application/x-httpd-php .png ) So, it should parse .php even with the .gif extension, but as a .php file it works fine, just as it should but as a .gif file it says can not display this image because it contains errors. Quote Link to comment https://forums.phpfreaks.com/topic/173977-need-some-help-with-using-php-module-with-gif-file-formats/ Share on other sites More sharing options...
RussellReal Posted September 12, 2009 Share Posted September 12, 2009 with your .htaccess do this.. RewriteRule ^/babe.gif$ thePHPFile.php btw you're outputting as a png.. your addhandler is setting .png as an extension.. not .gif.. but either way that is a very bad idea to make images evaluate as php code just make rewrite rules.. the above rewrite will when a user requests xxx.com/babe.gif it will redirect them to thePHPFile.php.. and the php can spit out the image.. then the user will think they're seeing an image.. but its rly a php generated image.. clever huh?! Quote Link to comment https://forums.phpfreaks.com/topic/173977-need-some-help-with-using-php-module-with-gif-file-formats/#findComment-917096 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.