Hello facebook开发者可以帮我快速总结用户照片如何在我提供的背景图片中合并?
我已经尝试了文本及其工作。
编辑:
你好,这是我得到的一些代码:$ name是“用户的名字”,我说得对。
$canvas = imagecreatefromjpeg ("bg.jpg");
$black = imagecolorallocate( $canvas, 61, 61, 61 );
$font = "font.ttf";
imagettftext( $canvas, 15, -1, 51, 60, $black, $font, $name );
imagejpeg( $canvas, "img/".$fbid.".jpg", 50 );
ImageDestroy( $canvas );
现在我的问题是如何将用户的照片包含在后台?
答案 0 :(得分:1)
为了实现这一目标,您需要使用ImageMagick for PHP:http://php.net/manual/en/book.imagick.php。
$img1 = new Imagick( "YOUR_BACKGROUND.png" );
$img2 = new Imagick( "FB_IMAGE.png" );
$img1->compositeImage( $img2, imagick::COMPOSITE_COPYOPACITY, 0, 0 );
header('Content-type: image/png');
echo $img1;
?>
祝你好运!