From 5150bd8f263c9006577bfb2fae574b313f628c5e Mon Sep 17 00:00:00 2001 From: zzzyyh <2726408594@qq.com> Date: Wed, 20 Nov 2024 01:01:27 +0800 Subject: [PATCH] 123 --- app/common/library/Download.php | 9 ++++++++- app/common/service/qrcode/Goods.php | 1 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/common/library/Download.php b/app/common/library/Download.php index f10bc61d..ec5bbbc1 100644 --- a/app/common/library/Download.php +++ b/app/common/library/Download.php @@ -36,7 +36,14 @@ class Download $result = $this->curl($url); empty($result) && throwError('获取到的图片内容为空 url: ' . $url); $this->fwrite($savePath, $result); - } + + //特殊处理一下文件格式为webp的图片 + $mime = mime_content_type($savePath); + if ($mime=='image/webp') { + $im = imagecreatefromwebp($savePath); + imagepng($im, $savePath); + } + } return $savePath; } diff --git a/app/common/service/qrcode/Goods.php b/app/common/service/qrcode/Goods.php index 72afc705..5ee3cc66 100644 --- a/app/common/service/qrcode/Goods.php +++ b/app/common/service/qrcode/Goods.php @@ -96,6 +96,7 @@ class Goods extends BaseQRcode $fontPath = Grafika::fontsDir() . '/' . 'st-heiti-light.ttc'; // 打开海报背景图 $editor->open($backdropImage, $backdrop); + // 打开商品图片 $editor->open($goodsImage, $goodsUrl); // 重设商品图片宽高