开发者

Requesting Picture for Event

I've been trying to grab event pictures for a few days now, with no luck. I'm making a normal request just like all the other event eleme开发者_如何学编程nts:

https://graph.facebook.com/eventid/picture

Here's a non-functioning example (in explorer): https://developers.facebook.com/tools/explorer/?method=GET&path=107798885938238%2Fpicture

However parent, attending, declined, all work..

Thank you!


I've had the same problem as you have.

After some looking into it, I found the solution.

Use http://graph.facebook.com/eventid/?fields=picture&type=large

You can choose small, normal, large or square as type.

You can call this as a separate api call,

$event = $facebook->api('/'.$event['id']);

$picture = $facebook->api('/'.$event['id'].'?fields=picture&type=large');
$picture = $picture['picture'];

echo '<img src="'.$picture.'">';
echo $event['name'];

echo $event['end_time']; // will work, no need to call

or call for other fields at the same time. But then you'll have to define every field you want to call.

$event = $facebook->api('/'.$event['id'].'?fields=name,start_time,picture&type=large');

echo '<img src="'.$event['picture'].'">';
echo $event['name'];

echo $event['end_time']; // will not work, end_time hasn't been called
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜