summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorKjartan Mannes <kjartan@2.no-reply.drupal.org>2003-12-27 14:28:23 +0000
committerKjartan Mannes <kjartan@2.no-reply.drupal.org>2003-12-27 14:28:23 +0000
commit46f8f143225b7ef7ae7e8aa8c103275cc660f26b (patch)
tree34045d5425b843aace2734281a7f3d6f6a15be42 /modules
parent15f289a8f0ab4cc2e1253731ca5af5987b3af0d6 (diff)
downloadbrdo-46f8f143225b7ef7ae7e8aa8c103275cc660f26b.tar.gz
brdo-46f8f143225b7ef7ae7e8aa8c103275cc660f26b.tar.bz2
- Fixed switch in file_create_url().
- Fixed profile module not extracting mime type. - Improved file matching in profile module.
Diffstat (limited to 'modules')
-rw-r--r--modules/profile.module23
-rw-r--r--modules/profile/profile.module23
2 files changed, 42 insertions, 4 deletions
diff --git a/modules/profile.module b/modules/profile.module
index 38f44212c..62e942b89 100644
--- a/modules/profile.module
+++ b/modules/profile.module
@@ -219,8 +219,27 @@ function _profile_user_view(&$user, $mode) {
}
function profile_file_download($file) {
- if (strpos($file, variable_get("profile_avatar_path", "avatars")) === 0) {
- return array("Content-type: $mime");
+ if (strpos($file, variable_get("profile_avatar_path", "avatars") . FILE_SEPARATOR . 'avatar-') === 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]);
}
}
diff --git a/modules/profile/profile.module b/modules/profile/profile.module
index 38f44212c..62e942b89 100644
--- a/modules/profile/profile.module
+++ b/modules/profile/profile.module
@@ -219,8 +219,27 @@ function _profile_user_view(&$user, $mode) {
}
function profile_file_download($file) {
- if (strpos($file, variable_get("profile_avatar_path", "avatars")) === 0) {
- return array("Content-type: $mime");
+ if (strpos($file, variable_get("profile_avatar_path", "avatars") . FILE_SEPARATOR . 'avatar-') === 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]);
}
}