Location: PHPKode > scripts > PHP - GD Watermarker > php-gd-watermarker/watermarker-example.php
<?php
require_once 'phpgdwatermarker.php'; // Add water-marker library

$watermarker = new PhpGdWatermarker('pgwatermark.png', PhpGdWatermarker::VALIGN_CENTER, PhpGdWatermarker::HALIGN_CENTER);
$watermarker->setImageOverwrite(FALSE); // [OPTIONAL] Default is TRUE
$watermarker->setEdgePadding(10); // [OPTIONAL] Default is 5
$watermarker->setWatermarkedImageNamePostfix('_'. time()); // [OPTIONAL] used IFF ImageOverwrite is FALSE, default is '_watermarked'

if($watermarker->applyWaterMark('sample-image.jpg')){
    echo "APPLIED WATERMARK on TIMESTAMP-" . time();
} else {
    echo $watermarker->getLastErrorMessage();
}

/* Simples Example
require_once 'phpgdwatermarker.php';
$watermarker = new PhpGdWatermarker('pgwatermark.png');
if($watermarker->applyWaterMark('sample-image.jpg')){
    echo "APPLIED WATERMARK on TIMESTAMP-" . time();
} else {
    echo $watermarker->getLastErrorMessage();
}
// That's all you need to apply watermark in the center */

?>
Return current item: PHP - GD Watermarker