[英]Get Total Photo Count in a published post via Facebook Graph API
I am currently trying to get the total photo count in a published post via Facebook Graph API. 我目前正在尝试通过Facebook Graph API获取已发布帖子中的总照片数量。 I have tried
我努力了
me/albums?fields=count,name
我/相册?场=计数,名称
but this is counting the number of photos in an album. 但这是在计算相册中照片的数量。 Thanks in advance
提前致谢
$count =0;
$ALLalbums = $facebook->api('/me/albums?fields=id');
$pics = array();
foreach ($ALLalbums['data'] as $album) {
$pics = $facebook->api('/'.$album['id'].'/photos?fields=source,picture');
$pics[$album['id']] = $pics['data'];
}
//Albums
foreach ($pics as $album) {
//Count Pics Inside each album
foreach ($album as $img) {
$count++;
// you can get image as well by $img['source'];
}
}
echo $count;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.