PHP code example of peterujah / nano-stamp

1. Go to this page and download the library: Download peterujah/nano-stamp 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/ */

    

peterujah / nano-stamp example snippets


use Peterujah\NanoBlockTech\Stamp\Circle;
use Peterujah\NanoBlockTech\Stamp\Square;
use Peterujah\NanoBlockTech\Stamp\Colors;
use Peterujah\NanoBlockTech\Stamp\Stamp;

$shape = new Stamp(new Square(400, 200));
 
$shape = new Stamp(new Circle(400, 400));

$stamp = $shape->getContainerInstance();

$stamp->setFont(__DIR__ . '/font/industry-bold.ttf');
 
$stamp->setBackgroundColor(Colors::ALPHA_WHITE);

$stamp->drawBorder(Colors::VIOLET);

$stamp->drawCenterText("My Company Name Here",[
    "fontSize" => 20,
    "color" => Colors::VIOLET,
    "right" => 125,
    "top" => -30,
]); 
$stamp->drawCenterText("27 Aug 2023", [
    "fontSize" => 20,
    "color" => Colors::VIOLET,
    "right" => 80,
    "top" => 30,
]);
$stamp->drawCenterText("Verified Stamp", [
    "fontSize" => 20,
    "color" => Colors::VIOLET,
    "right" => 80,
    "top" => 90,
]);

$stamp->drawRightText("Vertical", [
    "fontSize" => 20,
    "color" => Colors::VIOLET,
    "top" => 110,
    "right" => 55,
]);

$stamp->drawLeftText("27 Aug 2023", [
    "fontSize" => 20,
    "color" => Colors::VIOLET,
    "top" => 170,
    "left" => 230,
]);

$stamp->drawRoundText("Round Text Here", 20, Colors::VIOLET, true);

$stamp->drawCenterText("Horizontal Text Here", [
    "fontSize" => 20,
    "color" => Colors::VIOLET,
    "top" => 200,
    "left" => 60,
]);
$stamp->drawCenterText("27 Aug 2023", [
    "fontSize" => 20,
    "color" => Colors::VIOLET,
    "top" => 250,
    "left" => 60,
]);

$stamp->drawVerticalText("Vertical Text Here", [
    "fontSize" => 20,
    "color" => Colors::VIOLET,
    "top" => 220,
    "left" => 10,
]);
$stamp->drawVerticalText("27 Aug 2023", [
    "fontSize" => 20,
    "color" => Colors::VIOLET,
    "top" => 170,
    "left" => 15,
]);

$stamp->create('stamp_image.png', "S");

$stamp->drawCenterImage(__DIR__ . "/company-logo.png", [
    "top" => 0,
    "left" => 0,
    "width" => 50,
    "height" => 50
]);