function _imagepicker_thumbs_display in Image Picker 5.2
2 calls to _imagepicker_thumbs_display()
File
- ./
imagepicker.module, line 2210 - Enables permitted roles to upload images for insertion into configured nodes.
Code
function _imagepicker_thumbs_display($result, $public = FALSE, $src = 'account') {
global $user;
$how_many = variable_get('imagepicker_advanced_browser_page', 25);
$browsercols = variable_get('imagepicker_advanced_browser_columns', 0);
$ct = 0;
$imgct = 0;
if ($result) {
$content = '<div class="clear-block">';
while ($img = db_fetch_array($result)) {
if ($public || $src == 'admin') {
$userdir = array(
'name' => $img['name'],
'uid' => $img['uid'],
);
}
else {
$userdir = array(
'uid' => $user->uid,
'name' => $user->name,
);
}
// img_id img_name img_title img_description
$imgpath = imagepicker_get_image_path($img, 'browser', $userdir);
if ($imgpath) {
if ($public) {
// paths
if ($src == 'account') {
$imgurl = 'user/' . $user->uid . '/imagepicker/images/browse_public/';
}
elseif ($src == 'admin') {
$imgurl = 'admin/settings/imagepicker/images/user/' . $img['uid'] . '/browse/';
}
else {
$imgurl = 'imagepicker/browse_public/';
}
}
else {
// paths
if ($src == 'account') {
$imgurl = 'user/' . $user->uid . '/imagepicker/images/browse/';
}
elseif ($src == 'admin') {
$imgurl = 'admin/settings/imagepicker/images/user/' . $img['uid'] . '/browse/';
}
else {
$imgurl = 'imagepicker/browse/';
}
}
$tooltip = $img['img_name'] . ': ' . $img['img_title'] . ' ' . $img['img_description'];
$imglink = '<img src="' . $imgpath . '" alt="' . $img['img_title'] . '" title="' . $tooltip . '" />';
$content .= '<div class="imgp_holder">';
$content .= l($imglink, $imgurl . $img['img_id'], array(), NULL, NULL, FALSE, TRUE);
$content .= '</div>';
$ct++;
if ($browsercols > 0 && $ct >= $browsercols) {
$content .= '</div><div class="clear-block">';
$ct = 0;
}
$imgct++;
}
}
}
if (!$imgct) {
return;
}
$content .= '</div>';
$content .= theme('pager', NULL, $how_many);
return $content;
}