<?php ################################################################################# # Watermark Image script usage example # For updates visit http://www.zubrag.com/scripts/ ################################################################################# // Images folder, must end with slash. $images_folder = '/img/'; // Save watermarked images to this folder, must end with slash. $destination_folder = '/img/dest/'; // Path to the watermark image (apply this image as watermark) $watermark_path = '/watermark.png'; // MOST LIKELY YOU WILL NOT NEED TO CHANGE CODE BELOW // Load functions for image watermarking include "watermark_image.class.php"; // Watermark all the "jpg" files from images folder // and save watermarked images into destination folder foreach (glob($images_folder . "*.jpg") as $filename) { // Image path $image_path = $filename; // Where to save watermarked image $imgdestpath = $destination_folder . basename($filename); // Watermark image $img = new Zubrag_watermark($image_path); $img->ApplyWatermark($watermark_path); $img->SaveAsFile($imgdestpath); $img->Free(); }
// Images folder, must end with slash. $images_folder = '/var/www/html/samples/php/watermark/case6/logo/'; // Save watermarked images to this folder, must end with slash. $destination_folder = '/var/www/html/samples/php/watermark/case6/dest/'; ################################################################################# # END OF SETTINGS ################################################################################# // Load functions for image watermarking include "watermark_text.class.php"; // Watermark all the "jpg" files from images folder // and save watermarked images into destination folder foreach (glob($images_folder . "*.jpg") as $filename) { // Image path $imgpath = $filename; // Where to save watermarked image $imgdestpath = $destination_folder . basename($filename); // create class instance $img = new Zubrag_watermark($imgpath); // shadow params $img->setShadow($drop_shadow, $shadow_color); // font params $img->setFont($font, $font_size); // Apply watermark $img->ApplyWatermark($text, $color, $angle, $offset_x, $offset_y); // Save on server $img->SaveAsFile($imgdestpath); // Output to browser //$img->Output(); // release resources $img->Free(); }