function imagepicker_image_page in Image Picker 6.2
Same name and namespace in other branches
- 5.2 imagepicker.module \imagepicker_image_page()
- 5 imagepicker.module \imagepicker_image_page()
- 7 imagepicker.functions.inc \imagepicker_image_page()
Menu callback; presents the image page for imagepicker
1 call to imagepicker_image_page()
- imagepicker_box in ./
imagepicker.functions.inc - all iframe links pass through here
File
- ./
imagepicker.functions.inc, line 248 - Imagepicker functions
Code
function imagepicker_image_page($img_id, $preset = FALSE) {
global $base_url;
$content = '';
$result = db_query_range("SELECT i.*, u.name FROM {imagepicker} AS i JOIN {users} AS u USING (uid) WHERE img_id = '%d'", $img_id, 0, 1);
$img = db_fetch_array($result);
if ($img && is_array($img) && count($img)) {
drupal_add_css(IMAGEPICKER_PATH . '/imagepicker.css');
$title = isset($img['img_title']) && $img['img_title'] ? htmlspecialchars_decode($img['img_title'], ENT_QUOTES) : '';
if ($title) {
$title = $title . ' | ' . variable_get('site_name', 'Drupal');
drupal_set_title($title);
}
// js link
$account = user_load(array(
'uid' => $img['uid'],
));
$link = isset($account->imagepicker_default_pagelink) ? $account->imagepicker_default_pagelink : variable_get('imagepicker_default_pagelink', 1);
if (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE) {
if (module_exists('imagecache') && variable_get('imagepicker_imagecache_enable', 0) && $preset) {
$imgpath = imagepicker_get_image_path($img, 'full', array(
'uid' => $img['uid'],
), TRUE);
$imgpath = preg_replace("~__PRESET__~", $preset, $imgpath);
}
else {
$imgpath = imagepicker_get_image_path($img, 'full', array(
'uid' => $img['uid'],
));
}
}
else {
if (module_exists('imagecache') && variable_get('imagepicker_imagecache_enable', 0) && $preset) {
$imgpath = imagepicker_get_image_path($img, 'full', array(
'uid' => $img['uid'],
), TRUE);
$imgpath = preg_replace("~__PRESET__~", $preset, $imgpath);
}
else {
$imgpath = imagepicker_get_path(TRUE, $img) . $img['img_name'];
}
}
$content = theme('imagepicker_fullpage', $img, $imgpath, $link);
}
else {
drupal_set_message(t('Image not found in page.'), 'error');
}
return $content;
}