当用户从他们的照片列表中选择图像时,获取图像URL

时间:2012-03-30 23:30:32

标签: php facebook facebook-graph-api

我有一个显示用户图片的列表,(已经允许访问该应用的用户)。

<div class="list inline">
    $i = 0;
    foreach ($photos as $photo) {
        // Extract the pieces of info we need from the requests above
        $id = idx($photo, 'id');
        $picture = idx($photo, 'picture');
        $link = idx($photo, 'link');

        $class = ($i++ % 4 === 0) ? 'first-column' : '';
?>
<li style="background-image: url(<?php echo he($picture); ?>);" class="<?php echo $class; ?>"'

我需要允许用户选择一个。当他/她这样做时,我可以获得该图像的唯一ID或URL,将其加载到嵌入到项目中的不同api中(通过src可能???)

非常感谢任何帮助。感谢。

1 个答案:

答案 0 :(得分:2)

不确定您的意思,但也许您可以将图片下载到本地,然后在您想要的任何API中使用它?

file_get_contents($picture);