Location: PHPKode > scripts > twzWatermark > index.php
<?php
/*
    Example usage for twzWatermark.class.php
    
    tweezy include file			© 2007
    COPYRIGHT All code in this file and associated files is copyright © tweezy.net.au unless otherwise noted. 
    For enquiries please contact hide@address.com
*/

if(isset($_GET['example']))
    {
    require('twzWatermark.class.php');
    
    switch((int)$_GET['example'])
        {
        case 1:
            // using text as watermark
            $Watermark='Copyright &#169; 2007 example.com';
            $wm = new twzWatermark('base1.jpg', $Watermark);
            $wm->SetTextFont('verdana.ttf', 12, '#ddd', 0);
            $wm->SetTextShadow('#222');
            $wm->SetPosition('mb'); // for text, shld call SetPosition AFTER SetTextFont
            $wm->GetImage('');	
            break;
        case 2:
            // using angled text as watermark
            $BaseImage='base1.jpg';
            $Watermark='Copyright &#169; 2007 example.com';
            $wm = new twzWatermark($BaseImage, $Watermark);
            $wm->SetTextFont('verdana.ttf', 12, '#ddd', 90);
            $wm->SetTextShadow('#222');
            // positioning of angled text is a bit dodgy in this version!
            $size=getimagesize($BaseImage);
            $wm->SetPosition($size[0]-5, $size[1]-10);
            $wm->GetImage('');	
            break;
        case 3:
            // using png image as watermark (20% opacity)
            $wm = new twzWatermark('base1.jpg', 'twzWM20.png');
            $wm->SetPosition('cc');
            $wm->GetImage('');	
            break;
        case 4:
            // using png image in bottom right (30% opacity)
            $wm = new twzWatermark('base1.jpg', 'wmCrown30.png');
            $wm->SetPosition('rb');
            $wm->GetImage('');	
            break;
        }
    }


echo '<p><b>Select an example to view</b> (after viewing, use your browser\'s Back button to return here)</p>';
echo '<p> &nbsp; <a href="?example=1">Example 1</a> - using text as watermark</p>';
echo '<p> &nbsp; <a href="?example=2">Example 2</a> - using angled text as watermark</p>';
echo '<p> &nbsp; <a href="?example=3">Example 3</a> - using png image as watermark (20% opacity)</p>';
echo '<p> &nbsp; <a href="?example=4">Example 4</a> - using png image in bottom right (30% opacity)</p>';

?>
Return current item: twzWatermark