function image_fetch in Image 5
Same name and namespace in other branches
- 5.2 image.module \image_fetch()
- 6 image.module \image_fetch()
Fetches an image file, allows "shorthand" image urls such of the form: image/view/$nid/$label (e.g. image/view/25/thumbnail or image/view/14)
1 string reference to 'image_fetch'
- image_menu in ./
image.module - Implementation of hook_menu
File
- ./
image.module, line 764
Code
function image_fetch($nid = 0, $size = IMAGE_PREVIEW) {
if ($size == IMAGE_ORIGINAL && !user_access('view original images')) {
return drupal_access_denied();
}
if (isset($nid)) {
$node = node_load(array(
'type' => 'image',
'nid' => $nid,
));
if ($node) {
if (!node_access('view', $node)) {
return drupal_access_denied();
}
if (isset($node->images[$size])) {
$file = $node->images[$size];
$headers = image_file_download($file);
file_transfer($file, $headers);
}
}
}
return drupal_not_found();
}