开发者

Create image from Friend's profile images - Facebook/PHP

开发者 https://www.devze.com 2023-03-09 21:57 出处:网络
I want 开发者_高级运维to create an application where I\'ll create an image from the application user\'s friends profile image.

I want 开发者_高级运维to create an application where I'll create an image from the application user's friends profile image.

Create image from Friend's profile images - Facebook/PHP

In this image there are 4 photos of friends, I want to create a new [single] image in that image all of the images will be pasted.

What is the best way to go about doing this?


if i get your question right you will first need all their pictures, try the following:

$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" />';
}


Use imagecopymerge() function to add the four jpg profile images in a single image. Then, use the graph API to get user friend .

 imagecopymerge($mainimg, $friends, $dst_x, $dst_y, 0, 0, $src_w, $src_h, $pct); 

Here mainimg is representing your Background image. You can build an individual image in php using GD functions.

0

精彩评论

暂无评论...
验证码 换一张
取 消