//详情图片生成
public function NewPhotoXq($goods_name,$quanhoujia,$yuanjia,$yishou,$nickname){
//文字生成图片
$size_goods_name = 28;
$size_quanhoujia = 20;
$size_yuanjia = 15;
$size_yishou = 15;
$size_nickname = 22;
$size_tuijian = 18;
$size_changan = 18;
$text_goods_name = mb_substr($goods_name,0,16,'utf-8').'...';
$text_quanhoujia = '券后价¥'.$quanhoujia;
$text_yuanjia = '原价¥'.$yuanjia;
$text_nickname = '好友'.$nickname;
$text_yishou = '已售'.$yishou;
$text_tuijian = '推荐您享受内购优惠';
$text_changan = '长按识别';
//使用imagecreate()方法创建一张长为500px,高为80px的空白图片。
$img = imagecreate(750,400);
//使用imagecolorallocate()方法给图片配置颜色,这里设置为白色。
imagecolorallocate($img,0xff,0xff,0xff);
//字体要绝对路径
$font = \Yii::$app->basePath . '/../frontend/uploads/font/msyh.ttc
|