PHP Classes

File: example

Recommend this page to a friend!
  Classes of Eric Bruggema   Easy Thumbnail and Watermark class   example   Download  
File: example
Role: Example script
Content type: text/plain
Description: example file
Class: Easy Thumbnail and Watermark class
Add watermarks and resize images
Author: By
Last change:
Date: 13 years ago
Size: 904 bytes
 

Contents

Class file image Download
<?php
include("class.thumbnail.php");

// load class
$thumb = new thumbnail();

$file = 'example.png';
// load filename
$thumb->load($file);

// get file information
$info = $thumb->getsize(); // returns width/height;

// resize image
$thumb->resize($x,
              
$y,
              
true);
// add watermark
$thumb->watermark('watermark.png',
                 
'RIGHT',
                 
'CENTER',
                 
10,
                 
$hmargin);
// add text watermark
$thumb->watermarkText('Watermark',
                     
'00CC00',
                     
'font.ttf',
                     
'BOTTOM',
                     
'LEFT',
                     
5,
                     
5);
// save as png
$file = $thumb->save("file.png",
                    
"png",
                    
9);
// display as JPEG
$thumb->display("jpg",
               
85);

?>