我正在尝试获取登录的用户朋友的个人资料图像。问题是当我img src
用来显示返回的图像时,它可以工作并显示图像,但是当我使用它时div background-image
它不会返回正确的图像链接.
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;
}
这<div class="miprofile-pic-cnt" style="background-image:url('.$picture.')" ></div>
就是我所指的 div,而在这种背景图像的方法中,只是将图像链接显示为https://graph.facebook.com/7460374244/picture?type=large
,应该类似于sdsd.jpg
. 当我使用img src intead of div, it works fine