Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method SISANU_Emails_Catch_All::load_textdomain() should not be called statically in /home/mbucur/public_html/wp-includes/class-wp-hook.php on line 286
Batch watermarking – Marian Bucur

Batch watermarking


  * Batch watermarking.
// Create a new Watermark_My_Image object with no parameters as we will set the file path later.
$watermark = new Watermark_My_Image();
// Create a new Watermark_My_Image_text object passing a string as a parameter.
$text = new Watermark_My_Image_Text('Enjoy using Watermark My Image Standalone Class');
// Customize the text.
// Create a gd resource.
$icon_resource = imagecreatefrompng('images/heart.png');
// Colorize the image.
imagefilter($icon_resource, IMG_FILTER_COLORIZE, 211, 211, 211);
// Create an icon object using the colorized image.
$icon = new Watermark_My_Image_Icon($icon_resource);
// Customize the watermark, add the text and icon.
$src_dir = 'demo10_src/';
if ($handle = opendir($src_dir)) {
    // Process each file from the directory.
    while (false !== ($entry = readdir($handle))) {
        if (is_file($src_dir . $entry)) {
             // Set the file path to the source image and save the watermarked image to the destination directori.
             $watermark->set_file_path($src_dir . $entry)
                      ->save('demo10_dst/' . $entry);
             // Get and display errors.
             $errors = $watermark->get_errors();
             if ($errors) {
                 // Stop the execution if there is any error.