zScripz Posted February 8, 2014 Share Posted February 8, 2014 Aight, so I've made a dynamic signature, all that is fine, etc however, for some reason, even when specified to output a png image, I get a php page. The code (this is a test for it, this theoretically should work): <?php $my_img = imagecreate( 200, 80 ); $background = imagecolorallocate( $my_img, 0, 0, 255 ); $text_colour = imagecolorallocate( $my_img, 255, 255, 0 ); $line_colour = imagecolorallocate( $my_img, 128, 255, 0 ); imagestring( $my_img, 4, 30, 25, "testing", $text_colour ); imagesetthickness ( $my_img, 5 ); imageline( $my_img, 30, 45, 165, 45, $line_colour ); header( "Content-type: image/png" ); imagepng( $my_img ); imagecolordeallocate( $line_color ); imagecolordeallocate( $text_color ); imagecolordeallocate( $background ); imagedestroy( $my_img ); ?> Output: http://www.zscriptz.x10.mx/gensig/12.php Notice that when you go there, it will say "12.php" not "12.png" Could this be my webhost? Any help is appreciated Quote Link to comment Share on other sites More sharing options...
Parameter Posted February 8, 2014 Share Posted February 8, 2014 That's because you haven't actually saved it as a png file. You need to modify .htaccess to allow a png file to be parsed as a php file. Quote Link to comment Share on other sites More sharing options...
Celeos Posted February 8, 2014 Share Posted February 8, 2014 As mentioned above, modify your .htaccess file. Code: RewriteRule ^gensig.png$ gensig.php [L] Quote Link to comment Share on other sites More sharing options...
Parameter Posted February 8, 2014 Share Posted February 8, 2014 To be quite honest with you I cried when you showed that you do not understand file extensions. Quote Link to comment Share on other sites More sharing options...
zScripz Posted February 8, 2014 Author Share Posted February 8, 2014 To be quite honest with you I cried when you showed that you do not understand file extensions. To be quite honest I don't give a fuck 2 Quote Link to comment Share on other sites More sharing options...
Parameter Posted February 8, 2014 Share Posted February 8, 2014 To be quite honest I don't give a fuck Figure it out on yourself then. Quote Link to comment Share on other sites More sharing options...
zScripz Posted February 8, 2014 Author Share Posted February 8, 2014 Figure it out on yourself then. All I did was ask for help. What I didn't ask for is for you to vent your superiority issues on me. I don't know what you're trying to prove here, that I'm not as skilled as you in a language that I have learned very little about? Because you're right. There was absolutely no need for your comment other than to enlarge dat e-peen, which I guess you did. So congrats. Quote Link to comment Share on other sites More sharing options...
Parameter Posted February 8, 2014 Share Posted February 8, 2014 (edited) All I did was ask for help. What I didn't ask for is for you to vent your superiority issues on me. I don't know what you're trying to prove here, that I'm not as skilled as you in a language that I have learned very little about? Because you're right. There was absolutely no need for your comment other than to enlarge dat e-peen, which I guess you did. So congrats. I gave you an answer and I gave my own opinion. This had nothing at all to do with the language, it's basic understanding of file extensions which any computer user who has more knowledge than my grandmother should know about. It's not like I only posted the insult, I posted it together with an answer. Now either you can continue bitching about it or take it as a man and take a look at the answer I provided you with, it's up to you. Edited February 8, 2014 by Parameter 2 Quote Link to comment Share on other sites More sharing options...
zScripz Posted February 8, 2014 Author Share Posted February 8, 2014 I gave you an answer and I gave my own opinion. This had nothing at all to do with the language, it's basic understanding of file extensions which any computer user who has more knowledge than my grandmother should know about. It's not like I only posted the insult, I posted it together with an answer. Now either you can continue bitching about it or take it as a man and take a look at the answer I provided you with, it's up to you. <?php header('Content-Type: image/png'); ?> So tell me why this didn't work? Quote Link to comment Share on other sites More sharing options...
Parameter Posted February 8, 2014 Share Posted February 8, 2014 <?php header('Content-Type: image/png'); ?> So tell me why this didn't work? Alright. You see, you've saved the file as .php, the file extension won't magically change so you'll need to save it as .png if you want it to look like a .png file. Now, here comes the 'tricky' part, you need to modify (or create if you don't already have it) your .htaccess file. Why? Then your .png files will be parsed as .php files. Quote Link to comment Share on other sites More sharing options...
zScripz Posted February 8, 2014 Author Share Posted February 8, 2014 (edited) EDIT: For anyone who may use this at a later, none of the above worked for me. I came up with another solution however; .htaccess: <Files fakelogo.png> //whatever file you use below ForceType application/x-httpd-php //parses it as a php file </Files> Then create a fakelogo (mine was fakelogo.png), edit it and put your output method Edited February 8, 2014 by zScripz Quote Link to comment Share on other sites More sharing options...
Parameter Posted February 9, 2014 Share Posted February 9, 2014 EDIT: For anyone who may use this at a later, none of the above worked for me. I came up with another solution however; .htaccess: <Files fakelogo.png> //whatever file you use below ForceType application/x-httpd-php //parses it as a php file </Files> Then create a fakelogo (mine was fakelogo.png), edit it and put your output method You do know that's exactly what we told you to do lol Quote Link to comment Share on other sites More sharing options...
BrainDeadGenius Posted February 12, 2014 Share Posted February 12, 2014 (edited) Actually, all you need to do is edit the .htaccess, like mentioned above.Output: Edited February 16, 2014 by BrainDeadGenius Quote Link to comment Share on other sites More sharing options...
cowcowcowcow Posted February 14, 2014 Share Posted February 14, 2014 helped alot Quote Link to comment Share on other sites More sharing options...