Jump to content

Needing help.


Recommended Posts


I am trying to use imagecreatefrompng() , but every image I put in it rather it is PNG or JPEG it does not recognize it, and throws an error of invalid png.

This is the code I am using..

header ("Content-type: image/png");
$string = "Testing";
$font = 8;
$width = imagefontwidth($font) * strlen($string);
$height = imagefontheight($font) ;
$im = imagecreatefrompng("test.png");
$x = imagesx($im) - $width;
$y = imagesy($im) - $height;
$backgroundColor = imagecolorallocate ($im, 255, 255, 255);
$textColor = imagecolorallocate ($im, 0, 0,0);
imagestring ($im, $font, $x, $y,  $string, $textColor);


I have also tried the imagecreatefromstring() also as an other website stated, but same thing lol

Also php info everything is enabled.

Edited by lucky3809
Link to comment
Share on other sites

This can be removed, I found a solution to this, that works the same!!!


@Sniko, I have tried full path to it, I found 1 picture that allowed me to use it, but it was a blank white one, when I altered it, it than did not read the pic no longer for some reason. I used photoshop and paint and the end stayed png. Unless the code does not read pictures but only blank ones.

Edited by lucky3809
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...