function user_file_download

Implements hook_file_download().

Ensure that user pictures (avatars) are always downloadable.

File

modules/user/user.module, line 913

Code

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'],
        );
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.