PHP code example of vyalov.alexander / imagedefender

1. Go to this page and download the library: Download vyalov.alexander/imagedefender 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/ */

    

vyalov.alexander / imagedefender example snippets



$factory = new \VyalovAlexander\ImageDefender\GD\GDImageDefenderFactory();

//Objects are ready to work
$signDefender = $factory->getSignImageDefender();
$stampDefender = $factory->getStampImageDefender();



//you can configure your "stamp defender"
$stampDefender->setStamp('path/to/stmap/image.png')
    ->setStampHeight($height)
    ->setStampWidth($width)
    ->setStampMarginRight($marginRight)
    ->setStampMarginBottom($marginBottom)
    ->setStampTransparency($transparency);

$stampDefender->impose('path/to/picture/you/want/to/protect.png', "/save/path/of/resulting/picture.png");


//you can configure your "sign defender"
$signDefender->setFont('path/to/your/TTF/font.ttf')
        ->setSign($textYouWantToImpose)
        ->setSignAngle($textAngle)
        ->setSignColor($red, $green, $blue)
        ->setSignFontSize($fontSize)
        ->setSignMarginBottom($marginRight)
        ->setSignMarginRight($marginRight)
        ->setSignTransparency($textTransparency);

$signDefender->impose('path/to/picture/you/want/to/protect.png', "/save/path/of/resulting/picture.png");