From: Michael J. Rubinsky Date: Mon, 15 Feb 2010 18:39:58 +0000 (-0500) Subject: Track multipage image support in Horde_Image X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=cbdfd1f34ba8a0f0218268a01f4d580d2fa018f7;p=horde.git Track multipage image support in Horde_Image --- diff --git a/imp/lib/Mime/Viewer/Pdf.php b/imp/lib/Mime/Viewer/Pdf.php index 8bc55e3c8..39c63697b 100644 --- a/imp/lib/Mime/Viewer/Pdf.php +++ b/imp/lib/Mime/Viewer/Pdf.php @@ -107,16 +107,23 @@ class IMP_Horde_Mime_Viewer_Pdf extends Horde_Mime_Viewer_Pdf */ protected function _getHordeImageOb($load) { - if (empty($GLOBALS['conf']['image']['convert'])) { + if (!$GLOBALS['conf']['image']['driver']) { return false; } - + $context = array('tmpdir' => Horde::getTempdir()); + if (!empty($GLOBALS['conf']['image']['convert'])) { + $context['convert'] = $GLOBALS['conf']['image']['convert']; + $context['identify'] = $GLOBALS['conf']['image']['identify']; + } try { - $img = Horde_Image::factory('Im', array('context' => array('tmpdir' => Horde::getTempdir(), - 'convert'=> $GLOBALS['conf']['image']['convert']))); + $img = Horde_Image::factory($GLOBALS['conf']['image']['driver'], array('context' => $context)); } catch (Horde_Image_Exception $e) { return false; } + if (!$img->hasCapability('multipage') && !$img->hasCapability('pdf')) { + return false; + } + if ($load) { try { $ret = $img->loadString(1, $this->_mimepart->getContents()); @@ -125,7 +132,7 @@ class IMP_Horde_Mime_Viewer_Pdf extends Horde_Mime_Viewer_Pdf } } - return $img; + return $img->getImageAtIndex(0); } /**