[ansel] Image watermark user pref patch

Heath S. Hendrickson heath at outerspaceconsultants.com
Tue Jan 20 22:14:26 PST 2004


Attached is a patch that let's a user configure a custom watermark in 
there preferences.

It doesn't include the pop-up for defining the text on the fly, but it 
at least lets the user define the text in the preferences.

Ratches applied to config/prefs.php.dist and image.php

heath

-------------- next part --------------
Index: image.php
===================================================================
RCS file: /usr/local/horde/cvs/ansel/image.php,v
retrieving revision 1.56
diff -u -r1.56 image.php
--- image.php	20 Jan 2004 18:13:46 -0000	1.56
+++ image.php	21 Jan 2004 06:12:03 -0000
@@ -304,7 +304,11 @@
             break;
 
         case 'watermark':
-            $image->watermark();
+            if (!empty($prefs->getValue('watermark'))) {
+                $image->watermark($prefs->getValue('watermark'));
+            } else {
+                $image->watermark();
+            }
             break;
         }
 
@@ -381,7 +385,11 @@
 
 case 'imagewatermark':
     $image = &$ansel_shares->getImageById($image_id);
-    $image->watermark();
+    if (!empty($prefs->getValue('watermark'))) {
+        $image->watermark($prefs->getValue('watermark'));
+    } else {
+        $image->watermark();
+    }
     $image->display();
     exit;
     break;
Index: config/prefs.php.dist
===================================================================
RCS file: /usr/local/horde/cvs/ansel/config/prefs.php.dist,v
retrieving revision 1.19
diff -u -r1.19 prefs.php.dist
--- config/prefs.php.dist	20 Jan 2004 20:15:30 -0000	1.19
+++ config/prefs.php.dist	21 Jan 2004 06:09:46 -0000
@@ -21,7 +21,7 @@
     'label' => _("Display Options"),
     'desc' => _("Change your display options."),
     'members' => array('listtype', 'showdefaultimages', 'imagesperrow', 'imagesperpage',
-                       'showexif')
+                       'watermark', 'showexif')
 );
 
 $prefGroups['gallery'] = array(
@@ -120,4 +120,12 @@
     'shared' => false,
     'type' => 'checkbox',
     'desc' => _("Show EXIF data")
+);
+
+$_prefs['watermark'] = array(
+    'value' => '',
+    'locked' => false,
+    'shared' => false,
+    'type' => 'text',
+    'desc' => _("Custom watermark to use for images")
 );


More information about the ansel mailing list