[Tool/Web/Other] [PHP]ImagePNG not creating imagefile?
#1

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^^
Reply
#2

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.
Reply
#3

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^^
Reply
#4

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!!).
Reply
#5

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
Reply
#6

Show us your code.
Reply
#7

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 ); //
Reply
#8

Код:
$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
Reply
#9

****** 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..
Reply
#10

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
Код:
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)