moonsflyer пре 4 месеци
родитељ
комит
084981563c
1 измењених фајлова са 14 додато и 0 уклоњено
  1. 14 0
      app/common/service/ImageCompressService.php

+ 14 - 0
app/common/service/ImageCompressService.php

@@ -133,6 +133,20 @@ class ImageCompressService
                     outFileLog('内存限制: ' . $memoryLimit . ', 当前使用: ' . $currentMemory, 'upload_img', 'memory_info');
 
                     $image = imagecreatefromjpeg($path);
+                    if ($image === false) {
+                        // 获取详细错误信息
+                        $error = error_get_last();
+                        outFileLog('PNG创建失败,错误信息: ' . json_encode($error), 'upload_img', 'png_create_error');
+     
+
+                        // 尝试使用getimagesize验证
+                        $imageInfo = @getimagesize($path);
+                        if ($imageInfo === false) {
+                            throw new Exception('PNG文件无法被识别,可能已损坏');
+                        }
+
+                        outFileLog('PNG图片信息: ' . json_encode($imageInfo), 'upload_img', 'png_image_info');
+                    }
                     break;
                 case IMAGETYPE_PNG:
                     // PNG特殊处理