$form->getInfo(null, $info);
$tmp = Horde::getTempDir();
- $driver = empty($conf['image']['convert']) ? 'gd' : 'im';
$img = Ansel::getImageObject();
try {
$img->loadFile($info['image']['file']);
/* Create Horde_Image driver. */
$img = Ansel::getImageObject();
-$driver = empty($conf['image']['convert']) ? 'Gd' : 'Im';
try {
$result = $img->loadFile($path);
} catch (Horde_Image_Exception $e) {
$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);
}
$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'],
<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 <em>must not</em>
- 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>
/* 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. */
$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);