我想创建一个应用程序,我将从应用程序用户的朋友个人资料图像中创建一个图像。
在此图片中有4张朋友的照片,我想在该图像中创建一个新的[单张]图像,所有图像都将被粘贴。
这样做的最佳方式是什么?
答案 0 :(得分:0)
如果我的问题得到解决,你首先需要他们所有的照片,请尝试以下方法:
$facebook_friends = json_decode(file_get_contents('https://graph.facebook.com/me/friends?access_token=' .
$_SESSION['cookie']['access_token']), true);
$friends = $facebook_friends['data'];
foreach($friends as $key => $values){
echo '<img src="http://graph.facebook.com/'.$value['id'].'/picture" />';
}
答案 1 :(得分:0)
使用imagecopymerge()
功能在单张图片中添加四张jpg
个人资料图片。然后,使用图表API
获取用户朋友。
imagecopymerge($mainimg, $friends, $dst_x, $dst_y, 0, 0, $src_w, $src_h, $pct);
此处mainimg
代表您的背景图片。您可以使用GD
函数在php中构建单个图像。