I am attempting to create an image and I have run into a snag. I want to add both text and another image to the image I am making. Here is the code so far minus unnecessary parts:
header ("Content-type: image/png");
$name = $fetch_user['username'];
$rank = $fetch_rank['rank_title'];
$img_url = 'path''. $fetch_rank['rank_image'];
$im = @imagecreatefrompng("$img_url")
or die("Cannot Initialize new GD image stream");
// try changing this as well
$font = 4;
$width = imagefontwidth($font) * strlen($string) ;
$height = imagefontheight($font) ;
$im = imagecreatefrompng("image.png");
$x = imagesx($im) - $width ;
$y = imagesy($im) - $height;
$backgroundColor = imagecolorallocate ($im, 255, 255, 255);
$textColor = imagecolorallocate ($im, 255, 255, 255);
//imagestring ($im, $font, $x, $y, $string, $textColor);
imagestring ($im, $font, 100, 10, $name, $textColor);
imagestring ($im, $font, 100, 22, $rank, $textColor);
imagepng($im);
Everything works UNTIL I added in this part:
$im = @imagecreatefrompng("$img_url")
or die("Cannot Initialize new GD image stream");
Any idea what I am doing wrong? All that comes up is "Cannot Initialize new GD image stream"; and I know the URL's work.