function imagecache_transfer in ImageCache 6.2
Same name and namespace in other branches
- 5.2 imagecache.module \imagecache_transfer()
Helper function to transfer files from imagecache.
Determines MIME type and sets a last modified header.
Parameters
$path: String containing the path to file to be transferred.
Return value
This function does not return. It calls exit().
2 calls to imagecache_transfer()
- imagecache_cache_private in ./
imagecache.module - callback for handling private files imagecache requests
- _imagecache_cache in ./
imagecache.module - Handle request validation and responses to ImageCache requests.
File
- ./
imagecache.module, line 526 - Dynamic image resizer and image cacher.
Code
function imagecache_transfer($path) {
$size = getimagesize($path);
$headers = array(
'Content-Type: ' . mime_header_encode($size['mime']),
);
if ($fileinfo = stat($path)) {
$headers[] = 'Content-Length: ' . $fileinfo[7];
$headers[] = 'Expires: ' . gmdate('D, d M Y H:i:s', time() + 1209600) . ' GMT';
$headers[] = 'Cache-Control: max-age=1209600, private, must-revalidate';
_imagecache_cache_set_cache_headers($fileinfo, $headers);
}
file_transfer($path, $headers);
exit;
}