由于某种原因,我似乎无法合并 2 张图像,而且我不知道自己做错了什么。这对我来说还是有点新鲜。这是我的代码:
$source = 'http://localhost:8888/develop/trunk/develop/wp-content/uploads/2012/07/card01-80x80.jpg';
$im = imagecreatetruecolor(200, 200);
$black = imagecolorallocate($im, 0, 0, 0);
// Make the background transparent
imagecolortransparent($im, $black);
$text_color = imagecolorallocate($im, 255, 255, 255);
imagestring($im, 1, 5, 5, "A Simple Text String", $text_color);
imagejpeg($im, WP_UPLOADS_PATH . 'post-image-generator/1.jpg');
//merge images
$thumb = imagecreatefromjpeg($source);
$destination = imagecreatefromjpeg(WP_UPLOADS_PATH . 'post-image-generator/1.jpg');
imagecopymerge($destination, $thumb, 0, 0, 0, 0, 0, 0, 100);
imagejpeg($destination, WP_UPLOADS_PATH . 'post-image-generator/1.jpg');
echo "
<style></style>
<img src='" . WP_UPLOADS_URL . 'post-image-generator/1.jpg' . "' />
";
imagedestroy($thumb);
imagedestroy($destination);
imagedestroy($im);
它生成以下内容:
但还应包括以下图像:
任何帮助表示赞赏