(finally) update horde's config to reflect new Horde_Image driver structure
authorMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 14 Feb 2010 21:48:32 +0000 (16:48 -0500)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Sun, 14 Feb 2010 21:48:32 +0000 (16:48 -0500)
ansel/faces/search/image.php
ansel/faces/search/image_save.php
ansel/lib/Ansel.php
folks/lib/Driver.php
horde/config/conf.xml
horde/services/images/view.php
news/lib/News.php

index 44cdf29..c7893b1 100644 (file)
@@ -22,7 +22,6 @@ if ($form->validate()) {
     $form->getInfo(null, $info);
 
     $tmp = Horde::getTempDir();
-    $driver = empty($conf['image']['convert']) ? 'gd' : 'im';
     $img = Ansel::getImageObject();
     try {
         $img->loadFile($info['image']['file']);
index 2206ce3..691d3ff 100644 (file)
@@ -33,7 +33,6 @@ if ($x2 - $x1 < 50 || $y2 - $y1 < 50) {
 
 /* Create Horde_Image driver. */
 $img = Ansel::getImageObject();
-$driver = empty($conf['image']['convert']) ? 'Gd' : 'Im';
 try {
     $result = $img->loadFile($path);
 } catch (Horde_Image_Exception $e) {
index 7957125..062d1f0 100644 (file)
@@ -523,12 +523,13 @@ class Ansel
         $context = array('tmpdir' => Horde::getTempDir());
         if (!empty($conf['image']['convert'])) {
             $context['convert'] = $conf['image']['convert'];
+            $context['identify'] = $conf['image']['identify'];
         }
         $params = array_merge(array('type' => $conf['image']['type'],
                                     'context' => $context),
                               $params);
-        //@TODO: get around to updating horde/config/conf.xml to include the imagick driver
-        $driver = empty($conf['image']['convert']) ? 'Gd' : 'Im';
+
+        $driver = $conf['image']['driver'];
         return Horde_Image::factory($driver, $params);
     }
 
index 96337df..6abcb22 100644 (file)
@@ -90,10 +90,11 @@ class Folks_Driver {
         $p = hash('md5', $user);
         $vfspath = Folks::VFS_PATH . '/' . substr(str_pad($p, 2, 0, STR_PAD_LEFT), -2) . '/';
         $vfs_name = $p . '.' . $conf['images']['image_type'];
-        $driver = empty($conf['image']['convert']) ? 'Gd' : 'Im';
+        $driver = $conf['image']['driver'];
         $context = array('tmpdir' => Horde::getTempDir());
         if (!empty($conf['image']['convert'])) {
             $context['convert'] = $conf['image']['convert'];
+            $context['identify'] = $conf['image']['identify'];
         }
         $img = Horde_Image::factory($driver,
                                     array('type' => $conf['images']['image_type'],
index 30dc89e..9553a0d 100644 (file)
  <configtab name="image" desc="Image Manipulation">
   <configsection name="image">
    <configheader>Image Manipulation Settings</configheader>
-   <configstring name="convert" required="false" desc="Horde requires either
-   GD support built-in to PHP (--with-gd) or the ImageMagick software package
-   (optionally supported by the 'imagick' PHP extension) to do image
-   manipulation/creation. If using ImageMagick, specify the full path name to
-   the 'convert' program. On Windows, this path &lt;em&gt;must not&lt;/em&gt;
-   have spaces in it. Use DOS-style abbreviations if necessary: Progra~1
-   instead of Program Files, for instance. If using GD, or using neither,
-   leave this field blank."/>
+   <configswitch name="driver" description="What driver should we use for
+   manipulating images?">Im
+   <case name="Im" desc="Imagemagick">
+     <configstring name="convert" desc="Path to the 'convert' binary"></configstring>
+     <configstring name="identify" desc="Path the 'identify' binary"></configstring>
+   </case>
+   <case name="Imagick" desc="The PECL Imagick Library"></case>
+   <case name="Gd" desc="The PHP GD2 extensions (not recommended)."></case>
+   </configswitch>
   </configsection>
   <configsection name="exif" desc="Image Metadata">
    <configheader>Image Metadata Driver Settings</configheader>
index a8b621b..add8ba2 100644 (file)
@@ -68,12 +68,12 @@ case 'tmp':
 
 /* Load the image object. */
 $context = array('tmpdir' => Horde::getTempDir());
+$driver = $conf['image']['driver'];
 if (!empty($conf['image']['convert'])) {
     $context['convert'] = $conf['image']['convert'];
-    $image = Horde_Image::factory('Im', array('context' => $context));
-} else {
-    $image = Horde_Image::factory('Gd', array('context' => $context));
+    $context['identify'] = $conf['image']['identify'];
 }
+$image = Horde_Image::factory($driver, array('context' => $context));
 $image->loadString($file, $file_data);
 
 /* Check if no editing action required and send the image to browser. */
index efff36d..f5841e9 100644 (file)
@@ -266,10 +266,11 @@ class News {
         $context = array('tmpdir' => Horde::getTempDir());
         if (!empty($conf['image']['convert'])) {
             $context['convert'] = $conf['image']['convert'];
+            $context['identify'] = $conf['image']['identify'];
         }
         $params = array('type' => $conf['images']['image_type'],
                         'context' => $context);
-        $driver = empty($conf['image']['convert']) ? 'Gd' : 'Im';
+        $driver = $conf['image']['driver'];
         $img = Horde_Image::factory($driver, $params);
         $result = $img->loadFile($file);