Page 1 of 1

Watermarking of uploaded Images

Posted: Tue 1. Aug 2006, 14:53
by pico
Hi

for another Reason I have replaced the ss-imge-Class with something other in my System.

This makes it possible to add a Watermark Image and/or Text to a Image when uploading with Filecenter. Have not checked if this is also with ss_image_Class is possible.

This works with GD2 only.

Installation:

- add this to your ../config/phpwcms/conf.inc.php

Code: Select all

// GD2 Watermark Stuff
$phpwcms["watermark_img"]    = "watermark.png";          // Path from root/File for Watermark accepted files 
																		   // are GIF, JPG, PNG and PNG alpha
$phpwcms["watermark_pos"]    = "TR";                     // watermark position withing the image, 
                                                         // a combination of one or two from 'TBLR': top, bottom, left, right
$phpwcms["img_text"]         = 'meinBild';               // creates a text label on the image 
$phpwcms["img_text_pos"]     = 'BR';                     // same as watermark_pos
$phpwcms["img_text_col"]     = '#ff0000';                // Text Color
$phpwcms["img_text_trans"]   = 50;                       // transparence 0-100 
- make a Backup of ../include/inc_lib/imagick.convert.inc.php first
- download the ZIP, extract and upload the Files to your Server

If you want to recreate all uploaded Imgaes, backup ../content/images
and delete all Image-Files - when next a Image will be loaded it will generated new here with Watermark.

Download -> http://dev.phpwcms-xt.de/download/image_class.zip
ZIP contains:
../watermark.png - Sample Image for Watermark
../include/inc_ext/image_class/ - the new Image-Class
../include/inc_lib/imagick.convert.inc.php

hope it works for you - have fun

Posted: Tue 1. Aug 2006, 17:05
by ff123
I've tried the script and it works perfect! :D

Just some few wishes :roll: :
- the watermark is presented in large format also on the thumbnail, which makes the thumbnail hard to see, perhaps the thumbnail shouldn't have a watermark.
- perhaps the watermark could be posiotioned anywhere hby giving pixel coordinates (not that necessary)

for the rest it is a welcome addition to phpwcms for the media websites!

Posted: Tue 1. Aug 2006, 18:42
by pico
HI

ok - here it is

add this to your conf.inc.php

Code: Select all

$phpwcms["watermark_x"]      = '10';							  // absolute Possition of Watermark
$phpwcms["watermark_y"]      = '10';                       // x-y in pixels from the left/top border. can be negative
and this to your imagick.convert.inc.php ~Line 215
after

Code: Select all

        $image->image_watermark          = $GLOBALS['phpwcms']["watermark_img"];
        $image->image_watermark_position = $GLOBALS['phpwcms']["watermark_pos"];
this

Code: Select all

        $image->image_watermark_x        = $GLOBALS['phpwcms']["watermark_x"];
        $image->image_watermark_y        = $GLOBALS['phpwcms']["watermark_y"];
Leave $phpwcms["watermark_pos"] = ""; blank if you use X-Y and if you use _pos use $phpwcms["watermark_x"] = ''; for x and y

take a look to .. include/inc_ext/image_class/class.upload.php to see more Options what are possible with this Class - you can add them by the same way as you see above.

A difference between Thumb and Content-Image is not that easy, cause the Image Generation is called from different Places, so it need to modify all this calls with a optional Parameter - but I will take a look to it.

Posted: Mon 11. Sep 2006, 16:30
by ff123
hi pico,

the watermark solution seems to have some problems. cetrtain images dont get the weatermark, the thumb does.

Like here:
http://www.gertpaassenfotografie.nl/bloemen.phtml

vuurvos

Posted: Mon 11. Sep 2006, 16:44
by ff123
ff123 wrote: It seems the problem is that I had set $phpwcms['img_prev_width'] to 700px.
With $phpwcms['img_prev_width'] = 538 it works fine it seems for now :? .
I have set $phpwcms['img_prev_width'] to 700
and $phpwcms['img_prev_height'] to 400

Now it works fine.
But now it shows an image with 700px*469px. So he looks at max width 700 and not at max height 400, strange :? .

Posted: Fri 18. May 2007, 09:47
by Carino
Geht das auch für Originalbilder? bei Thumbnails macht das ja wenig Sinn.