From: Michael J. Rubinsky Date: Sun, 2 Aug 2009 20:12:13 +0000 (-0400) Subject: Track changes in Horde_Image X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=ec973036c5245cc47250a6c9d217192204ebb8e8;p=horde.git Track changes in Horde_Image --- diff --git a/imp/lib/Mime/Viewer/Images.php b/imp/lib/Mime/Viewer/Images.php index 6df5b9d3e..b1929a66d 100644 --- a/imp/lib/Mime/Viewer/Images.php +++ b/imp/lib/Mime/Viewer/Images.php @@ -253,20 +253,25 @@ EOD; $img = null; //@TODO: Pass in a Horde_Logger in $context if desired. $context = array('tmpdir' => Horde::getTempDir()); - if (!empty($GLOBALS['conf']['image']['convert'])) { - $context['convert'] = $GLOBALS['conf']['image']['convert']; - $img = Horde_Image::factory('Im', array('context' => $context)); - } elseif (Horde_Util::extensionExists('gd')) { - $img = Horde_Image::factory('Gd', array('context' => $context)); + try { + if (!empty($GLOBALS['conf']['image']['convert'])) { + $context['convert'] = $GLOBALS['conf']['image']['convert']; + $img = Horde_Image::factory('Im', array('context' => $context)); + } elseif (Horde_Util::extensionExists('gd')) { + $img = Horde_Image::factory('Gd', array('context' => $context)); + } + } catch (Horde_Image_Exception $e) { + return false; } - if (!$img || ($img instanceof PEAR_Error)) { + if (!$img) { return false; } if ($load) { - $ret = $img->loadString(1, $this->_mimepart->getContents()); - if ($ret instanceof PEAR_Error) { + try { + $ret = $img->loadString(1, $this->_mimepart->getContents()); + } catch (Horde_Image_Exception $e) { return false; } } diff --git a/imp/lib/Mime/Viewer/Pdf.php b/imp/lib/Mime/Viewer/Pdf.php index 8ec5a7c68..5a51213e4 100644 --- a/imp/lib/Mime/Viewer/Pdf.php +++ b/imp/lib/Mime/Viewer/Pdf.php @@ -114,15 +114,16 @@ class IMP_Horde_Mime_Viewer_Pdf extends Horde_Mime_Viewer_Pdf return false; } - $img = Horde_Image::factory('Im', array('context' => array('tmpdir' => Horde::getTempdir(), - 'convert' => $GLOBALS['conf']['image']['convert']))); - if ($img instanceof PEAR_Error) { + try { + $img = Horde_Image::factory('Im', array('context' => array('tmpdir' => Horde::getTempdir(), + 'convert'=> $GLOBALS['conf']['image']['convert']))); + } catch (Horde_Image_Exception $e) { return false; } - if ($load) { - $ret = $img->loadString(1, $this->_mimepart->getContents()); - if ($ret instanceof PEAR_Error) { + try { + $ret = $img->loadString(1, $this->_mimepart->getContents()); + } catch (Horde_Image_Exception $e) { return false; } } diff --git a/news/lib/News.php b/news/lib/News.php index ed7a66e94..b1092f284 100644 --- a/news/lib/News.php +++ b/news/lib/News.php @@ -271,15 +271,7 @@ class News { 'context' => $context); $driver = empty($conf['image']['convert']) ? 'Gd' : 'Im'; $img = Horde_Image::factory($driver, $params); - - if ($img instanceof PEAR_Error) { - return $img; - } - $result = $img->loadFile($file); - if ($result instanceof PEAR_Error) { - return $result; - } // Store big image for articles if ($type == 'news') {