user_file_download

Versions
4.6 – 6
user_file_download($file)
7
user_file_download($uri)

Implement hook_file_download().

Ensure that user pictures (avatars) are always downloadable.

Code

modules/user/user.module, line 756

<?php
function user_file_download($uri) {
  if (strpos(file_uri_target($uri), variable_get('user_picture_path', 'pictures') . '/picture-') === 0) {
    $info = image_get_info($uri);
    return array('Content-Type' => $info['mime_type']);
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.