[ansel] Patch for user pref image type

Heath S. Hendrickson heath at outerspaceconsultants.com
Tue Jan 20 11:50:51 PST 2004


The attached patch goes with the user pref patches submitted earlier.  
This makes it user configurable what format should be used for the 
system created image files (_thumb and _screen).

heath
-------------- next part --------------
Index: lib/Ansel.php
===================================================================
RCS file: /usr/local/horde/cvs/ansel/lib/Ansel.php,v
retrieving revision 1.37
diff -u -r1.37 Ansel.php
--- lib/Ansel.php	19 Jan 2004 18:22:50 -0000	1.37
+++ lib/Ansel.php	20 Jan 2004 16:10:36 -0000
@@ -140,12 +140,18 @@
 
     function &getImageObject()
     {
-        global $conf;
+        global $conf, $prefs;
         require_once HORDE_LIBS . 'Horde/Image.php';
+        // 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';
+        }
         if (!empty($conf['image']['convert'])) {
-            return Horde_Image::singleton('im');
+            return Horde_Image::singleton('im',array( 'type' => $im_type ));
         } else {
-            return Horde_Image::singleton('gd');
+            return Horde_Image::singleton('gd',array( 'type' => $im_type ));
         }
     }
 


More information about the ansel mailing list