Make the max size of image viewable inline configurable
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 12 Nov 2008 04:36:43 +0000 (21:36 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 12 Nov 2008 04:36:43 +0000 (21:36 -0700)
imp/config/mime_drivers.php.dist
imp/lib/Mime/Viewer/images.php

index 05ff22e..0c7e429 100644 (file)
@@ -105,7 +105,9 @@ $mime_drivers['imp']['images'] = array(
         'default' => 'image.png'
     ),
     /* Display thumbnails for all images, not just large images? */
-    'allthumbs' => true
+    'allthumbs' => true,
+    /* Display images inline that are less than this size. */
+    'inlinesize' => 262144
 );
 
 /**
index d70164e..b1f18dd 100644 (file)
@@ -75,9 +75,10 @@ class IMP_Horde_Mime_Viewer_images extends Horde_Mime_Viewer_images
     protected function _renderInline()
     {
         /* Only display the image inline if the browser can display it and the
-         * size of the image is small. */
+         * size of the image is below the config value. */
         if ($GLOBALS['browser']->isViewable($this->_getType())) {
-            if ($this->_mimepart->getBytes() < 51200) {
+            if (isset($this->_conf['inlinesize']) &&
+                ($this->_mimepart->getBytes() < $this->_conf['inlinesize'])) {
                 /* Viewing inline, and the browser can handle the image type
                  * directly. So output an <img> tag to load the image. */
                 return array(