Beispiel #1
0
$image_file = FILES . 'test.png';
$watermark_file = FILES . 'watermark.png';
/***********************
 *** APPLY WATERMARK ***
 ***********************/
$image = new Image($image_file);
$watermark = new Watermark($watermark_file);
$watermark->setPosition('bottom right')->apply($image)->generate(OUTPUT . 'watermark1-apply.png');
/**************************
 *** ALTERING WATERMARK ***
 **************************/
$image = new Image($image_file);
$watermark = new Watermark($watermark_file);
$watermark->rotate(90)->negate()->setPosition('bottom right')->apply($image)->generate(OUTPUT . 'watermark2-rotate.png');
/***************************
 *** EVERYTHING TOGETHER ***
 ***************************/
$image = new Image($image_file);
$watermark = new Watermark($watermark_file);
$watermark->rotate(45)->setPosition('bottom right')->setSize(250, 90)->setMargin(-20)->apply($image);
// Apply a second watermark
$watermark->setPosition('top left')->setMargin(20)->apply($image);
$image->rotate(45)->resize('min', 400);
$watermark->rotate(-45)->resize('resize', 400)->setPosition('centered')->apply($image);
// Create a new Watermark object to watermark the resulting file
$watermark = new Watermark($watermark_file);
$watermark->setPosition('bottom right')->apply($image);
// generate the resulting image
$image->generate(OUTPUT . 'watermark3-all-together.png');
echo "All examples are now available under the 'output' folder\n";
// END OF FILE
Beispiel #2
0
 } else {
     $is_img = FALSE;
 }
 // upload
 move_uploaded_file($tempFile, $targetFile);
 if ($_GET['no_wm'] != 1) {
     $image = new Image($targetFile);
     if (!empty($targetFile)) {
         $imgData = getimagesize($targetFile);
         if ($imgData[1] > $imgData[0]) {
             $wimg = 'maglivs.png';
         } else {
             $wimg = 'ganivs.png';
         }
     }
     $watermark = new Watermark($_SERVER['DOCUMENT_ROOT'] . '/img/' . $wimg);
     $watermark->setPosition('top left')->apply($image);
     $image->generate($targetFile);
 }
 if ($is_img) {
     $memory_error = FALSE;
     if (!create_img($targetFile, $targetFileThumb, 122, 91)) {
         $memory_error = FALSE;
     } else {
         // TODO something with this long function baaaah...
         if (!new_thumbnails_creation($targetPath, $targetFile, $_FILES['file']['name'], $current_path, $relative_image_creation, $relative_path_from_current_pos, $relative_image_creation_name_to_prepend, $relative_image_creation_name_to_append, $relative_image_creation_width, $relative_image_creation_height, $relative_image_creation_option, $fixed_image_creation, $fixed_path_from_filemanager, $fixed_image_creation_name_to_prepend, $fixed_image_creation_to_append, $fixed_image_creation_width, $fixed_image_creation_height, $fixed_image_creation_option)) {
             $memory_error = FALSE;
         } else {
             $imginfo = getimagesize($targetFile);
             $srcWidth = $imginfo[0];
             $srcHeight = $imginfo[1];