Calling all Drupal developers!
Help us get this on the first page of Digg. DIGG NOW!
Help us get this on the first page of Digg. DIGG NOW!
avatar_selection_file_download($file)
contributions/avatar_selection/avatar_selection.module, line 1088
Implementation of hook_file_download().
Ensure that user pictures (avatars) are always downloadable.
$file The path to the file that will be checked if downloadable.
An array containing the file mime type and size, generated by the array() function, if everything is fine. NULL, if the file is not downloadable.
<?php
function avatar_selection_file_download($file) {
if (user_access('access content')) {
$data = explode('/', $file);
$icon = array_pop($data);
$folder = implode('/', $data);
if ('avatar_selection' == $folder) {
$info = image_get_info(file_create_path($file));
return array(
'Content-type: '. $info['mime_type'],
'Content-length: '. $info['file_size'],
);
}
else {
return null;
}
}
}
?>