修复webp转换其他格式失败

This commit is contained in:
icret
2022-03-10 23:40:15 +08:00
parent 8b05affa30
commit 736588e98d
6 changed files with 24 additions and 19 deletions

View File

@@ -38,7 +38,12 @@ if ($handle->uploaded) {
// 最小高度
$handle->image_min_height = $config['minHeight'];
// 转换图片为指定格式
$handle->image_convert = $config['imgConvert'];
if (isset($config['imgConvert'])) {
// 只转换非webp格式和非动态图片
if ($handle->file_src_name_ext !== 'webp' && !isAnimatedGif($handle->file_src_pathname)) {
$handle->image_convert = $config['imgConvert'];
}
}
/* 等比例缩减图片 放到前端了
if ($config['imgRatio']) {
@@ -51,13 +56,6 @@ if ($handle->uploaded) {
// 存储图片路径:images/201807/
$handle->process(APP_ROOT . config_path());
/*
// 创建缩略图 开启后会个别返回文件失败暂时没找到替代方案如果启用此项目需要将list.php中的get_online_thumbnail改成return_thumbnail_images函数
if ($config['thumbnail']) {
@creat_thumbnail_images($handle->file_dst_name);
}
*/
// 图片完整相对路径:/i/2021/05/03/k88e7p.jpg
if ($handle->processed) {
header('Content-type:text/json');