PHP code example of saopanda / image-make

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

    

saopanda / image-make example snippets


$config = new ImageMakeConfig();
$config
    ->alpha(true)               //  设置透明度支持
    ->fontSize(20)              //  设置默认字体大小
    ->exportSize(1920, 1080)    //  设置底图大小  
    ->exportType(2)             //  设置输出图片格式
    ->font('/font/abc');        //  设置默认字体
    
ImageMake::new($config);        //  传入 new()
ImageMake::new();               //  使用默认设置

public function img(string $value, int $x = 0, int $y = 0, int $new_width = 0, int $new_height = 0)

[
    'color'    =>  string 支持带透明度的16进制颜色,
    'size'     =>  int 字体大小,
    'wrap'     =>  false | array [
        20, //  int 多少字自动换行
        10  //  int 行高
    ],
    'font'     =>  string 字体路径,
    'deg'      =>  int 旋转角度,设置排列方向,效果:左到右、上到下
]

public function str(string $value, int $x = 0, int $y = 10, array $config = [])

public function get(string $filepath = null)

cd ./test/
php -S localhost:8080