diff options
author | Dries Buytaert <dries@buytaert.net> | 2004-03-27 09:06:52 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2004-03-27 09:06:52 +0000 |
commit | 0b876c4486d7a6905d9a6a2693c96b37963d63f6 (patch) | |
tree | d843dfbae9371ff7aa3689fa17953052a8f48585 | |
parent | 76c4be3138da1bb3a3293902f2751ca9d5bd3209 (diff) | |
download | brdo-0b876c4486d7a6905d9a6a2693c96b37963d63f6.tar.gz brdo-0b876c4486d7a6905d9a6a2693c96b37963d63f6.tar.bz2 |
- Patch #6425 by TDobes: made avatars work with private download method. Added
user_file_download() function to communicate with the file system layer.
-rw-r--r-- | modules/user.module | 25 | ||||
-rw-r--r-- | modules/user/user.module | 25 |
2 files changed, 50 insertions, 0 deletions
diff --git a/modules/user.module b/modules/user.module index d14cbeaff..13cb6c7a6 100644 --- a/modules/user.module +++ b/modules/user.module @@ -324,6 +324,31 @@ function user_perm() { return array("administer users", "access user list"); } +function user_file_download($file) { + if (strpos($file, variable_get('user_picture_path', "pictures") . FILE_SEPARATOR . 'picture-') === 0) { + list($width, $height, $type, $attr) = getimagesize(file_create_path($file)); + $types = array( + IMAGETYPE_GIF => 'image/gif', + IMAGETYPE_JPEG => 'image/jpeg', + IMAGETYPE_PNG => 'image/png', + IMAGETYPE_SWF => 'application/x-shockwave-flash', + IMAGETYPE_PSD => 'image/psd', + IMAGETYPE_BMP => 'image/bmp', + IMAGETYPE_TIFF_II => 'image/tiff', + IMAGETYPE_TIFF_MM => 'image/tiff', + IMAGETYPE_JPC => 'application/octet-stream', + IMAGETYPE_JP2 => 'image/jp2', + IMAGETYPE_JPX => 'application/octet-stream', + IMAGETYPE_JB2 => 'application/octet-stream', + IMAGETYPE_SWC => 'application/x-shockwave-flash', + IMAGETYPE_IFF => 'image/iff', + IMAGETYPE_WBMP => 'image/vnd.wap.wbmp', + IMAGETYPE_XBM => 'image/xbm' + ); + return array('Content-type: '. $types[$type]); + } +} + function user_search($keys) { $find = array(); $result = db_query_range("SELECT * FROM {users} WHERE name LIKE '%%%s%%'", $keys, 0, 20); diff --git a/modules/user/user.module b/modules/user/user.module index d14cbeaff..13cb6c7a6 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -324,6 +324,31 @@ function user_perm() { return array("administer users", "access user list"); } +function user_file_download($file) { + if (strpos($file, variable_get('user_picture_path', "pictures") . FILE_SEPARATOR . 'picture-') === 0) { + list($width, $height, $type, $attr) = getimagesize(file_create_path($file)); + $types = array( + IMAGETYPE_GIF => 'image/gif', + IMAGETYPE_JPEG => 'image/jpeg', + IMAGETYPE_PNG => 'image/png', + IMAGETYPE_SWF => 'application/x-shockwave-flash', + IMAGETYPE_PSD => 'image/psd', + IMAGETYPE_BMP => 'image/bmp', + IMAGETYPE_TIFF_II => 'image/tiff', + IMAGETYPE_TIFF_MM => 'image/tiff', + IMAGETYPE_JPC => 'application/octet-stream', + IMAGETYPE_JP2 => 'image/jp2', + IMAGETYPE_JPX => 'application/octet-stream', + IMAGETYPE_JB2 => 'application/octet-stream', + IMAGETYPE_SWC => 'application/x-shockwave-flash', + IMAGETYPE_IFF => 'image/iff', + IMAGETYPE_WBMP => 'image/vnd.wap.wbmp', + IMAGETYPE_XBM => 'image/xbm' + ); + return array('Content-type: '. $types[$type]); + } +} + function user_search($keys) { $find = array(); $result = db_query_range("SELECT * FROM {users} WHERE name LIKE '%%%s%%'", $keys, 0, 20); |