海報合成工具類

分享一個碼雲上挺好用的海報合成

碼雲

$config = array(
        'bg_url' => __DIR__ . '/../../' . $bg1,//背景圖片路徑
//    'text' => array(
//        array(
//            'text' => $title,//文本內容
//            'left' => 290, //左側字體開始的位置
//            'top' => 680, //字體的下邊框
//            'fontSize' => 38, //字號
//            'fontColor' => '234, 202, 161', //字體顏色
//            'angle' => 0,
//        ),
//        array(
//            'text' => $sub_title,
//            'left' => 150,
//            'top' => 750,
//            'width' => 500,
//            'fontSize' => 16, //字號
//            'fontColor' => '141, 142, 144', //字體顏色
//            'angle' => 0,
//        ),
//        array(
//            'text' => $activity_title,
//            'left' => 190,
//            'top' => 840,
//            'width' => 400,
//            'fontSize' => 31, //字號
//            'fontColor' => '234, 202, 161', //字體顏色
//            'angle' => 0,
//        ),

//    ),
        'image' => array(
//        array(
//            'url' => $person_img_sl,
//            'stream' => 0,
//            'left' => 300,
//            'top' => 390,
//            'right' => 0,
//            'bottom' => 0,
//            'width' => 180,
//            'height' => 180,
//            'radius' => 0,
//            'opacity' => 100
//        ),
            array(
                'url' => '',
                'stream' => $qrCodeData,//數據流
                'left' => 503,
                'top' => 1128,
                'right' => 0,
                'bottom' => 0,
                'width' => 120,
                'height' => 120,
                'radius' => 0,
                'opacity' => 100
            ),
        )
    );
    
 poster::setConfig($config);
//設置保存路徑
    $bg1_path = __DIR__ . "/img/poster_bg1_{$sharer_id}.png";
    $res = poster::make($bg1_path);
    poster::clear();
//或者直接顯示在瀏覽器上
$res = poster::make();
header("content-type:image/png");
   echo $res;
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章