SA-MP Forums Archive
[Tool/Web/Other] [PHP]ImagePNG not creating imagefile? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Other (https://sampforum.blast.hk/forumdisplay.php?fid=7)
+--- Forum: Everything and Nothing (https://sampforum.blast.hk/forumdisplay.php?fid=23)
+--- Thread: [Tool/Web/Other] [PHP]ImagePNG not creating imagefile? (/showthread.php?tid=129041)



[PHP]ImagePNG not creating imagefile? - saiberfun - 20.02.2010

hey guyz im trying to create the images for my webgen so its not just a temporary file
so u could use it just per bbcode and dont need to download and upload it then.

so now i try to create it like

for a test with:

ImagePNG($im,'test.png');

but it doesnt create my test.png

what could be the reasons for that?...

sure this is samp forum but would be awesome if u could help me with that^^


Re: [PHP]ImagePNG not creating imagefile? - gotenks918 - 20.02.2010

It's actually quite weird you say this. I had a php script running an image generator which had been working fine for about 2-3 weeks maybe a little bit longer then all of a sudden stopped. I was getting the message call to undefined function imagecreatefrompng.

BTW, post your code here or paste bin or something.


Re: [PHP]ImagePNG not creating imagefile? - saiberfun - 20.02.2010

Quote:
Originally Posted by gotenks918
It's actually quite weird you say this. I had a php script running an image generator which had been working fine for about 2-3 weeks maybe a little bit longer then all of a sudden stopped. I was getting the message call to undefined function imagecreatefrompng.

BTW, post your code here or paste bin or something.
that could have been maybe because of ur hoster reinstalling his php library and forgot GD Library

im just asking for if i did sumin wrong with this one line^^


Re: [PHP]ImagePNG not creating imagefile? - Donny_k - 20.02.2010

Have you tried using " " instead of ' ' ?

I don't know PHP but maybe this is an issue.

Also make sure that $im thing is a valid object or bitmap or whatever it is (lol I haven't a clue!!).


Re: [PHP]ImagePNG not creating imagefile? - saiberfun - 20.02.2010

Quote:
Originally Posted by Donny
Have you tried using " " instead of ' ' ?

I don't know PHP but maybe this is an issue.

Also make sure that $im thing is a valid object or bitmap or whatever it is (lol I haven't a clue!!).
it is as i used it before all i changed is tthat i added the second value which is optional and now should save the pic as this file
but it doesn
tried changing ' and " already :P


Re: [PHP]ImagePNG not creating imagefile? - Blantas - 20.02.2010

Show us your code.


Re: [PHP]ImagePNG not creating imagefile? - gotenks918 - 20.02.2010

As i said before XD
Код:
$my_img = imagecreatefrompng( "img.png" ); //img back ground
//All the text and shit goes here

header( "Content-type: image/png" );
imagepng( $my_img );
imagecolordeallocate( $blah ); //Restore memory and shiz
imagedestroy( $my_img ); //



Re: [PHP]ImagePNG not creating imagefile? - saiberfun - 20.02.2010

Код:
$fontfile = "./novamono.ttf";
$size = 25;
$x = 385;
$y = 25;
$im = imagecreatefrompng("show.png");
imagealphablending($im, true);
imagesavealpha($im, true);
$color = ImageColorAllocate($im, 255, 255, 255);
header("Content-Type: image/png");
ImageTTFText($im, $size, 0, $x, $y, $color, $fontfile, $_GET['text']);
ImagePNG($im,'lol.png'); //lol.png just for test



Re: [PHP]ImagePNG not creating imagefile? - Norn - 21.02.2010

****** php image dude the first page has plenty of examples that work..

ImagePNG($im); //lol.png just for test

Don't need that unless your saving..


Re: [PHP]ImagePNG not creating imagefile? - iLinx - 21.02.2010

you dont actually need to do anything, just make sure you have the proper content headers in your php script before you output it as a png.

You can access it like just like you would with a png.

Assuming site is example.com and image script is test.php, you could do this
Код: