douningqiu4991 2013-05-03 20:22 采纳率: 0%
浏览 14

如果在div中使用图像作为背景,则不会返回facebook sdk用户朋友图像

I am trying to get the profile image of a user's friend who logged in. The problem is when I use img src to display the returned image, it works and the image is displayed, but when I use div background-image then it doesn't return the correct image link.

function displayUsersIcons($criteria) {
$users = $criteria['users'];
$nb_display = $criteria['nb_display'];
$width = $criteria['width'];

if($width=='') $width="300";

if($nb_display>count($users) || $nb_display=='') $nb_display=count($users); //display value never bigger than nb users

$display = '';
for($i=0;$i<$nb_display;$i++) {
    $name = $users[$i]['name'];
    $picture = $users[$i]['picture'];
    $url = $users[$i]['url'];
        $display .= '<li class="span4">';
        $display .= '<div class="thumbnail">';
        $display .= '<h3>'.$name.'</h3>';
    $display .= '<a href="'.$url.'" target="_blank" title="'.$name.'">';
    $display .= '<div class="miprofile-pic-cnt" style="background-image:url('.$picture.')" ></div>';
    $display .= '</a>';
    $display .= '<div class="caption">';
    $display .= '<p><a href="#" class="btn btn-primary">Action</a> <a href="#" class="btn">Action</a></p>';
    $display .= '</div>';
    $display .= '</div>';
    $display .= '</li>';            



}
return $display;

}

In this the <div class="miprofile-pic-cnt" style="background-image:url('.$picture.')" ></div> is the div I am referring to, and in this the method of background image just displys the image links as https://graph.facebook.com/7460374244/picture?type=large, which should be something like sdsd.jpg. When I use img src intead of div, it works fine

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
    • ¥500 52810做蓝牙接受端
    • ¥15 基于PLC的三轴机械手程序
    • ¥15 多址通信方式的抗噪声性能和系统容量对比
    • ¥15 winform的chart曲线生成时有凸起
    • ¥15 msix packaging tool打包问题
    • ¥15 finalshell节点的搭建代码和那个端口代码教程
    • ¥15 Centos / PETSc / PETGEM
    • ¥15 centos7.9 IPv6端口telnet和端口监控问题
    • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作