1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
| private function createPoster($data) { $poster = new Poster(); $im = $poster->createTrueColor(672, 1060); $font_file = $this->typeface; $goodsImg = $poster->createImgBoard($im, $data['goodsPath'], 0, 0, 672, 668); $codeImg = $poster->createImgBoard($im, $data['qrcode'], 410, 710, 225, 225); $headImg = $poster->createImgBoard($im, $data['headimg'], 46, 942, 65, 65); $btnimg = $poster->createImgBoard($im, $data['btn'], 420, 960, 220, 48);
$price_font = ImageColorAllocate($im, 248, 6, 74); imagettftext($im, 25, 0, 41, 759, $price_font, $font_file, '¥'); imagettftext($im, 38, 0, 60, 760, $price_font, $font_file, $data["price"]);
$goodsName = trim(mb_substr($data['title'], 0, 20)); $good_font = ImageColorAllocate($im, 1, 1, 1); imagettftext($im, 24, 0, 40, 820, $good_font, $font_file, $poster->AutoWrap(12, 0, $font_file, $goodsName, 160));
$nickname = trim(mb_substr($data['nickname'], 0, 8)); $nick_font = ImageColorAllocate($im, 109, 114, 120); imagettftext($im, 16, 0, 130, 965, $nick_font, $font_file, $poster->AutoWrap(12, 0, $font_file, $nickname, 80)); imagettftext($im, 16, 0, 130, 1000, $nick_font, $font_file, $data['time']); ob_clean(); ob_end_clean(); $poster->lookImg($im);
imagedestroy($im); imagedestroy($btnimg); imagedestroy($goodsImg); imagedestroy($codeImg); imagedestroy($headImg); Qrcode::deleteCode($data['qrcode']); }
|