From 77884cb20ae5193ea47fbc61c7987879f349d55f Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 11 Nov 2008 21:36:43 -0700 Subject: [PATCH] Make the max size of image viewable inline configurable --- imp/config/mime_drivers.php.dist | 4 +++- imp/lib/Mime/Viewer/images.php | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/imp/config/mime_drivers.php.dist b/imp/config/mime_drivers.php.dist index 05ff22ec4..0c7e4290a 100644 --- a/imp/config/mime_drivers.php.dist +++ b/imp/config/mime_drivers.php.dist @@ -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 ); /** diff --git a/imp/lib/Mime/Viewer/images.php b/imp/lib/Mime/Viewer/images.php index d70164e3f..b1f18ddc9 100644 --- a/imp/lib/Mime/Viewer/images.php +++ b/imp/lib/Mime/Viewer/images.php @@ -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 tag to load the image. */ return array( -- 2.11.0