Don't assume we have a Horde_Image driver available
authorMichael J. Rubinsky <mrubinsk@horde.org>
Mon, 15 Feb 2010 18:27:37 +0000 (13:27 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Mon, 15 Feb 2010 18:27:37 +0000 (13:27 -0500)
imp/lib/Mime/Viewer/Images.php

index 98b25bc..04b29f3 100644 (file)
@@ -250,16 +250,18 @@ EOD;
      */
     protected function _getHordeImageOb($load)
     {
+        if (!$GLOBALS['conf']['image']['driver']) {
+            return false;
+        }
         $img = null;
         //@TODO: Pass in a Horde_Logger in $context if desired.
         $context = array('tmpdir' => Horde::getTempDir());
         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));
+                $context['identify'] = $GLOBALS['conf']['image']['identify'];
             }
+            $img = Horde_Image::factory($GLOBALS['conf']['image']['driver']);
         } catch (Horde_Image_Exception $e) {
             return false;
         }