function imagepicker_get_image_path in Image Picker 5.2
Same name and namespace in other branches
- 5 imagepicker.module \imagepicker_get_image_path()
- 6.2 imagepicker.module \imagepicker_get_image_path()
- 7 imagepicker.module \imagepicker_get_image_path()
8 calls to imagepicker_get_image_path()
- imagepicker_admin_images in ./
imagepicker.module - imagepicker_admin_view in ./
imagepicker.module - imagepicker_image_select in ./
imagepicker.module - imagepicker_js in ./
imagepicker.module - javascript insertion routine
- imagepicker_user_view in ./
imagepicker.module
File
- ./
imagepicker.module, line 568 - Enables permitted roles to upload images for insertion into configured nodes.
Code
function imagepicker_get_image_path($img, $type = 'browser', $public = FALSE) {
$imgbasedir = imagepicker_get_path(FALSE, $public ? $public : TRUE);
switch ($type) {
case 'browser':
if (file_exists($imgbasedir . IMAGEPICKER_BROWSER_DIR . DIRECTORY_SEPARATOR . $img['img_name'])) {
$imgpath = imagepicker_get_path(TRUE, $public ? $public : TRUE) . IMAGEPICKER_BROWSER_DIR . '/' . $img['img_name'];
}
elseif (file_exists($imgbasedir . IMAGEPICKER_THUMBS_DIR . DIRECTORY_SEPARATOR . $img['img_name'])) {
$imgpath = imagepicker_get_path(TRUE, $public ? $public : TRUE) . IMAGEPICKER_THUMBS_DIR . '/' . $img['img_name'];
}
break;
case 'full':
if (file_exists($imgbasedir . $img['img_name'])) {
$imgpath = imagepicker_get_path(TRUE, $public ? $public : TRUE) . $img['img_name'];
}
break;
case 'thumb':
default:
if (file_exists($imgbasedir . IMAGEPICKER_THUMBS_DIR . DIRECTORY_SEPARATOR . $img['img_name'])) {
$imgpath = imagepicker_get_path(TRUE, $public ? $public : TRUE) . IMAGEPICKER_THUMBS_DIR . '/' . $img['img_name'];
}
elseif (file_exists($imgbasedir . IMAGEPICKER_BROWSER_DIR . DIRECTORY_SEPARATOR . $img['img_name'])) {
$imgpath = imagepicker_get_path(TRUE, $public ? $public : TRUE) . IMAGEPICKER_BROWSER_DIR . '/' . $img['img_name'];
}
break;
}
return $imgpath ? $imgpath : '';
}