PHP code example of laofu110 / poster

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

    

laofu110 / poster example snippets


$config =[
    'bg' => '',//背景图片路径
    'format'=>'jpg',//支持jpg、png、gif
    'quality'=>75,//压缩质量(0-100),输出格式为jpg时比较明显
    'text' => [
        [
            'text' => '',
            'left' => 242, 
            'top' => 466,
            'fontSize' =>28,
            'fontColor' => '68,68,68',
            'angle' => 0,//旋转角度
        ],
    ],
    'image' =>[
        [
            'url' => '',//支持图片数据流、网络地址、本地路径
            'left' => 110,
            'top' => 420,
            'width' => 110,
            'height' => 110,
            'radius' => 50,
            'opacity' => 100,
        ],
    ]
];
$Poster=new \Laofu\Image\Poster($config);
$img=$Poster->make($filename);//当$filename=''时,会返回图片数据流,可以结合response直接输出到浏览器
if(!$img){
    $err=$Poster->errMsg;
}