PHP code example of fayyaztech / print_text_on_image

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

    

fayyaztech / print_text_on_image example snippets


     * @param String $imagePath image file path
     * @param int $x horizontal place on background image
     * @param int $y vertical place on background image
     * @param int $width image width
     * @param int $height image height
     * @param int $opacity image opacity/visibility

     * @param String $textContent text you want to print on image
     * @param Int $fontSize font size of that text
     * @param Int $angle rotation of text
     * @param Bool $textHorizontalCenter user can make text center auto by added true parameter
     * @param Int $x horizontal position of text
     * @param Int $y vertical position of text
     * @param $color $color color is black for now we will provide color option soon
     * @param String $font_location custom font if you want other wise default is arial

 
     * @param String $backgroundImagePath background image file path | remote url not allow | jpeg and png support
     * @param Array $data data should be an array of ConfigText and ConfigImage class
     * @param String $imageOptions download|preview|save
     * @param String $savePath if you want to save file on server directory. provide the path here and $imageOption must be save
     




yyaztech\PrintTextOnImage\ConfigImage;
use Fayyaztech\PrintTextOnImage\ConfigText;
use Fayyaztech\PrintTextOnImage\PrintTextOnImage as PrintTextOnImagePrintTextOnImage;

$setContent = [
    new ConfigText('Text on image', 30, 60, 30,0,true),
    new ConfigText('this is 2nd text', 30, 100, 10),
    new ConfigImage('php.png', 150, 100, 60, 30, 70),
];


$test = new PrintTextOnImagePrintTextOnImage('./white.png', $setContent, 'preview');
$test->generate();