PHP code example of harrykdeveloper / php-watermark-images

1. Go to this page and download the library: Download harrykdeveloper/php-watermark-images library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

harrykdeveloper / php-watermark-images example snippets



    /* 
     * To change this license header, choose License Headers in Project Properties.
     * To change this template file, choose Tools | Templates
     * and open the template in the editor.
     */

          * top-center | center | bottom-center | 
        * left-top | left-center | left-bottom | right-top | 
        * right-center | right-bottom
        */
        'position' => 'right-bottom',
        // full image path.
        'watermark_image' => 'watermark.png',
        // path from where files will be copied.
        'original_directory' => 'original',
        // path where files are copied after watermark implementation. 
        'converted_directory' => 'converted',
        // padding from image sides
        'padding' => 10
    ])->convertAll();

    /**
     * Errors
     */
    if($watermark->getErrors()){
        echo '<pre>Errors:';
        print_r($watermark->getErrors());
        echo '<pre/>';
    }

    /**
     * Success Watermark
     */
    if($watermark->getSuccess()){
        echo '<pre>Success:';
        print_r($watermark->getSuccess());
        echo '<pre/>';
    }

    /**
     * Failed images.
     */
    if($watermark->getFails()){
        echo '<pre>Fails:';
        print_r($watermark->getFails());
        echo '<pre/>';
    }