function taxonomy_image_file_download in Taxonomy Image 6
Same name and namespace in other branches
- 5 taxonomy_image.module \taxonomy_image_file_download()
File
- ./
taxonomy_image.module, line 464 - taxonomy_image.module Simple module for providing an association between taxonomy terms and images. Written by Jeremy Andrews <jeremy@kerneltrap.org>, May 2004.
Code
function taxonomy_image_file_download($file) {
if (user_access('access taxonomy images')) {
$path = file_create_path($file);
if (function_exists('mime_content_type')) {
if ($type = mime_content_type($path)) {
return array(
"Content-type: {$type}",
);
}
}
list($width, $height, $type, $attr) = getimagesize($path);
$types = array(
IMAGETYPE_GIF => 'image/gif',
IMAGETYPE_JPEG => 'image/jpeg',
IMAGETYPE_PNG => 'image/png',
IMAGETYPE_SWF => 'application/x-shockwave-flash',
IMAGETYPE_PSD => 'image/psd',
IMAGETYPE_BMP => 'image/bmp',
IMAGETYPE_TIFF_II => 'image/tiff',
IMAGETYPE_TIFF_MM => 'image/tiff',
IMAGETYPE_JPC => 'application/octet-stream',
IMAGETYPE_JP2 => 'image/jp2',
IMAGETYPE_JPX => 'application/octet-stream',
IMAGETYPE_JB2 => 'application/octet-stream',
IMAGETYPE_SWC => 'application/x-shockwave-flash',
IMAGETYPE_IFF => 'image/iff',
IMAGETYPE_WBMP => 'image/vnd.wap.wbmp',
IMAGETYPE_XBM => 'image/xbm',
);
if (isset($types[$type])) {
return array(
'Content-type: ' . $types[$type],
);
}
}
}