How can I put an image over an image? I am trying to put a 105x80px image onto a 210x80px image. Here is what I got to make the 210x80px image background. <?php header("Content-type: image/png"); $im = @imagecreate(210, 80) or die("Cannot Initialize new GD image stream"); $background_color = imagecolorallocate($im, 255, 255, 255); imagepng($im); imagedestroy($im); ?> PHP: I know how to add text, but not an image. If I wanted to add text I would use: <?php header("Content-type: image/png"); $im = @imagecreate(210, 80) or die("Cannot Initialize new GD image stream"); $background_color = imagecolorallocate($im, 255, 255, 255); $text_color = imagecolorallocate($im, 233, 14, 91); imagestring($im, 1, 5, 5, "This is my text here", $text_color); imagepng($im); imagedestroy($im); ?> PHP: So is there like an image function like imagestring except for images not text? I have tried imagesettile but I couldn't get it to work. I think I would need to use imagecopymerge but I couldn't get that to work either. Please Help
I'll do what you did and copy the php documents examples to show you. http://us2.php.net/manual/en/function.imagecopyresampled.php <?php function LoadJpeg($imgname) { $im = @imagecreatefromjpeg($imgname); /* Attempt to open */ if (!$im) { /* See if it failed */ $im = imagecreatetruecolor(150, 30); /* Create a black image */ $bgc = imagecolorallocate($im, 255, 255, 255); $tc = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 150, 30, $bgc); /* Output an errmsg */ imagestring($im, 1, 5, 5, "Error loading $imgname", $tc); } return $im; } header("Content-Type: image/jpeg"); $img = LoadJpeg("bogus.jpg"); $img2 = LoadJpeg("bogus2.jpg"); list($width, $height) = getimagesize("bogus.jpg"); $new_width = $width * $percent; $new_height = $height * $percent; // Resample imagecopyresampled($img2, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height); imagejpeg($img2,null,100); ?> PHP: