About

The best way to protect your images is to watermark them. But that can be a real problem.
This script will automaticly add a custom watermark on your pictures without modifying the original image. Isn't that cool?
Below you have instructions about how to use the script, but you also have commented code in the script.

Install

So , you have downloaded the watermark vs1.0.zip file. When you extract the contents you will find :

- watermark.class.php
- watermark.png
- images folder -> .htaccess file

Now using a FTP client, connect to your website , go to Classes -> PHP5 -> create a new folder named Watermark and transfer the watermark.class.php file.
Next, go to the uploads folder (or where you keep the images that you want to add watermark on), and transfer the .htacces file.
Open the .htacces file and you will have to modify the path to the watermark.php class:

.htacces content look like:

AddHandler watermarked .jpg
AddHandler watermarked .jpeg
AddHandler watermarked .gif
AddHandler watermarked .png

# call action
# path to wattermark.class.php
Action watermarked /watermark/watermark.class.php

Now all the images will have the waternark on. Wasn't that simple? ^^

Features and custom options

			
/* commens properties */
'debug' => true // if you set debug = true if error on watermark echo them
'curr_image' => false, // path tu current image. Auto load from $_SERVER["PATH_TRANSLATED"] superglobal
'curr_image_extension' => '', // explode from source image
'valid_image_extension' => array('jpeg', 'jpg', 'png', 'gif'), // available images extension
'opacity' => 0, // watermark image opacity. Default value = 100. Available value between 0 - 100
'min_size_for_wattermark' => 300, // if image is smaller then this value watermark not init

/* logo watermark */
'watermark_logo_path' => 'watermark.logo.png', // path to watermark logo

/* watermark position */
'valid_position' => array('top_left', 'top_center', 'top_right', 'center_left', 'center_center', 'center_right', 'bottom_left', 'bottom_center', 'bottom_right', 'repeat'), 

'position' => 'left_top', // watermark logo position.

top_left: 		top_center:			top_right: 
	X 0 0 			0 X 0 				0 0 X 
	0 0 0			0 0 0				0 0 0
	0 0 0			0 0 0				0 0 0


center_left: 	center_center:		center_right: 
	0 0 0			0 0 0				0 0 0
	X 0 0 			0 X 0 				0 0 X 
	0 0 0			0 0 0				0 0 0
	
	
bottom_left: 	bottom_center:		bottom_right: 
	0 0 0			0 0 0				0 0 0
	0 0 0			0 0 0				0 0 0
	X 0 0 			0 X 0 				0 0 X 
	
repeat
	X X X 
	X X X
	X X X

'margin' => 20	// margin between watermark logo and top / right / bottom / left

Basic example:


$smartWattermark =& smartWattermark::getInstance(array(
	'position' => 'repeat',
	'min_size_for_wattermark' => 200,
	'opacity' => 15,
	'watermark_logo_path' => 'watermark_repeat.png'
));