fd1453814ccaa9bf70a43188759268b0da514364
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d7 / hook / file_download.twig
1 /**
2  * Implements hook_file_download().
3  */
4 function {{ machine_name }}_file_download($uri) {
5   // Check if the file is controlled by the current module.
6   if (!file_prepare_directory($uri)) {
7     $uri = FALSE;
8   }
9   if (strpos(file_uri_target($uri), variable_get('user_picture_path', 'pictures') . '/picture-') === 0) {
10     if (!user_access('access user profiles')) {
11       // Access to the file is denied.
12       return -1;
13     }
14     else {
15       $info = image_get_info($uri);
16       return array('Content-Type' => $info['mime_type']);
17     }
18   }
19 }