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