[ansel] User configurable image formats for Ansel
Heath S. Hendrickson
heath at outerspaceconsultants.com
Sat Jan 10 11:06:52 PST 2004
Here are some patches to Ansel to support user configurable image
formats (currently JPEG and PNG, but others should be possible based on
IM and/or GD support) for the generated thumbnails and screen images.
I only had to patch ansel/lib/Ansel.php and ansel/config/prefs.php as
Horde's image libraries already supported sending in a parameter array
which could include a 'type' entry.
h
[root at space lib]# cvs diff Ansel.php
Index: Ansel.php
===================================================================
RCS file: /usr/local/horde/cvs/ansel/lib/Ansel.php,v
retrieving revision 1.30
diff -r1.30 Ansel.php
135c135
< global $conf;
---
> global $conf, $prefs;
136a137,143
> // sets the image type based on user pref, defaults to 'png'
> if($prefs->getValue('im_type')!='') {
> $im_type = $prefs->getValue('im_type');
> } else {
> $im_type = 'png';
> }
>
138c145
< return Horde_Image::singleton('im');
---
> return Horde_Image::singleton('im',array( 'type' =>
$im_type ));
140c147
< return Horde_Image::singleton('gd');
---
> return Horde_Image::singleton('gd',array( 'type' =>
$im_type ));
[root at space config]# diff prefs.php prefs.php.dist
30,31c30
< 'members' => array('listtype', 'showdefaultimages',
'imagesperrow', 'imagesperpage', 'im_type',
< 'watermark', 'auto_watermark')
---
> 'members' => array('listtype', 'showdefaultimages',
'imagesperrow', 'imagesperpage')
131,156d129
<
< $_prefs['im_type'] = array(
< 'value' => 'png',
< 'locked' => false,
< 'shared' => false,
< 'type' => 'enum',
< 'enum' => array('png' => _("PNG"),
< 'jpeg' => _("JPEG")),
< 'desc' => _("Image format for converted images (thumbnail and
screen resolutions)")
< );
<
< $_prefs['watermark'] = array(
< 'value' => '',
< 'locked' => false,
< 'shared' => false,
< 'type' => 'text',
< 'desc' => _("Watermark to use for images")
< );
<
< $_prefs['auto_watermark'] = array(
< 'value' => false,
< 'locked' => false,
< 'shared' => false,
< 'type' => 'checkbox',
< 'desc' => _("Automatically watermark all images")
< );
More information about the ansel
mailing list