> hi all, > > I noticed that attachments with .jpeg cannot be displayed automatically > by squirrelmail instead of .jpg. How to fix this?
I suspect that you confused image/jpeg and image/jpg mime types. If you are not using Mozilla, SquirrelMail 1.4.5 can display .jpeg attachments inline. Only .jpg attachments marked with image/jpg mime type are not displayed. If you are using Mozilla, SquirrelMail 1.4.6cvs has workarounds for 'HTTP_ACCEPT' header format used by Mozilla browsers. See attached version of functions/attachment_common.php Patch is made for 1.4.5 version. -- Tomas
attachment_common.php
Description: application/php
Index: attachment_common.php =================================================================== RCS file: /cvsroot/squirrelmail/squirrelmail/functions/attachment_common.php,v retrieving revision 1.25.2.6 diff -u -w -r1.25.2.6 attachment_common.php --- attachment_common.php 27 Dec 2004 15:03:43 -0000 1.25.2.6 +++ attachment_common.php 11 Nov 2005 06:34:09 -0000 @@ -8,7 +8,7 @@ * * This file provides the handling of often-used attachment types. * - * @version $Id: attachment_common.php,v 1.25.2.6 2004/12/27 15:03:43 kink Exp $ + * @version $Id: attachment_common.php,v 1.25.2.7 2005/07/31 14:32:38 tokul Exp $ * @package squirrelmail */ @@ -25,6 +25,7 @@ 'gif' => 'image/gif', 'htm' => 'text/html', 'html' => 'text/html', + 'jpe' => 'image/jpeg', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg', 'php' => 'text/plain', @@ -37,14 +38,17 @@ /* Register browser-supported image types */ sqgetGlobalVar('attachment_common_types', $attachment_common_types); if (isset($attachment_common_types)) { + // var is used to detect activation of jpeg image types + unset($jpeg_done); /* Don't run this before being logged in. That may happen when plugins include mime.php */ foreach ($attachment_common_types as $val => $v) { if ($val == 'image/gif') register_attachment_common('image/gif', 'link_image'); - elseif (($val == 'image/jpeg' || $val == 'image/pjpeg') and + elseif (($val == 'image/jpeg' || $val == 'image/pjpeg' || $val == 'image/jpg') and (!isset($jpeg_done))) { $jpeg_done = 1; + register_attachment_common('image/jpg', 'link_image'); register_attachment_common('image/jpeg', 'link_image'); register_attachment_common('image/pjpeg', 'link_image'); } @@ -52,6 +56,21 @@ register_attachment_common('image/png', 'link_image'); elseif ($val == 'image/x-xbitmap') register_attachment_common('image/x-xbitmap', 'link_image'); + elseif ($val == '*/*' || $val == 'image/*') { + /** + * browser (Firefox) declared that anything is acceptable. + * Lets register some common image types. + */ + if (! isset($jpeg_done)) { + $jpeg_done = 1; + register_attachment_common('image/jpg', 'link_image'); + register_attachment_common('image/jpeg', 'link_image'); + register_attachment_common('image/pjpeg', 'link_image'); + } + register_attachment_common('image/gif', 'link_image'); + register_attachment_common('image/png', 'link_image'); + register_attachment_common('image/x-xbitmap', 'link_image'); + } } unset($jpeg_done); }