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