php畫圖代碼

//創建畫布
$posterIm = imagecreatetruecolor($dstW, $detH);
$white = imagecolorallocate($posterIm, 255, 255, 255);
imagefill($posterIm, 0, 0, $white);
//合併並頭像
imagecopyresampled ($posterIm , $titleIm , 0 , 0 , 0 , 0 , $dstW , $titleH , $dstW , $titleH);

//合併消息
if(!empty($message)) {
    imagecopyresampled ($posterIm , $messageIm , 0 , $detH_ONE , 0 , 0 , $dstW , $messageH , $dstW , $messageH);
}
if(!empty($imgs)) {
    $imgIm = $this->_addImg($imgs);
    imagecopyresampled ($posterIm , $imgIm , 0 , $detH_TOW , 0 , 0 , $dstW , $imH , $dstW , $imH);
}

 

//合成標題以及用戶信息
private function _addTile($title, $avtarUrl, $nickeName, $time, &$titleH, $appid) {
    //過濾表情
    $title = preg_replace("#(\\\ud[0-9a-f]{3})#i", " ", $title);
    $nickeName = (mb_strlen($nickeName, 'utf-8') > 8) ? mb_substr($nickeName,0, 8).'...' : $nickeName;

    $titleColor = [80,60,40];
    $fontType = $fontType = self::POWER
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章