作者 何书鹏
1 个管道 的构建 通过 耗费 1 秒

海报优化

... ... @@ -422,7 +422,8 @@ class Index extends Api
$user_id = $this->auth->id > 0 ? $this->auth->id : 0;
$qrcode_id = "{$job_id}_{$user_id}";
$qrcode = $dir.'/qrcode_'.$qrcode_id.'.png';
if(!file_exists($qrcode)){
$img = imagecreatefromjpeg(ROOT_PATH.'public/'.$qrcode);
if(!file_exists($qrcode) || imagesx($img) != 192){
$user_id = $this->auth->id > 0 ? $this->auth->id : 0;
$response = Wechat::miniProgram()->app_code->getUnlimit($qrcode_id, [
'page' => 'pages/zhiwei_xq/zhiwei_xq',
... ... @@ -431,11 +432,7 @@ class Index extends Api
if ($response instanceof \EasyWeChat\Kernel\Http\StreamResponse) {
$response->saveAs($dir, str_replace($dir.'/','',$qrcode));
}
}
// 280不满足,再缩小
$img = imagecreatefromjpeg(ROOT_PATH.'public/'.$qrcode);
if(imagesx($img) != 192){
// 280不满足,再缩小
\think\Image::open($qrcode)->thumb(192,192,\think\Image::THUMB_CENTER)->save($qrcode);
}
... ...