function photos_image_get in Album Photos 7.3
Same name and namespace in other branches
- 6.2 inc/photos.image.inc \photos_image_get()
Output image.
1 string reference to 'photos_image_get'
- photos_menu in ./
photos.module - Implements hook_menu().
File
- inc/
photos.image.inc, line 224 - Handles image page view(s) and content.
Code
function photos_image_get($fid, $thumb) {
// @todo update $thumb to $style_name.
$filepath = str_replace('photos/get/' . $fid . '/' . $thumb . '/', '', $_GET['q']);
if (!is_file($filepath)) {
if ($thumb != 'original' && ($thumb = _photos_get_thumbname($thumb))) {
$str = "/thumb_{$fid}.*?thumb_/i";
$original = preg_replace($str, '', $filepath);
// deprecated: && ($filepath = photos_get_thumb($original, $fid, $thumb, 1))
if (is_file($original)) {
$true = 1;
}
}
if (!$true) {
drupal_add_http_header('Content-Type:', 'text/plain;');
echo t('Image does not exist');
drupal_exit();
}
}
$image = end(explode('.', $_GET['q']));
header('Content-type: image/' . $image);
if ($fd = @fopen($filepath, 'rb')) {
while (!feof($fd)) {
print fread($fd, 1024);
}
fclose($fd);
drupal_exit();
}
drupal_add_http_header('Content-Type:', 'text/plain;');
echo t('Image does not exist');
drupal_exit();
}