瀏覽代碼

Reorder image resizing operations

Visman 5 年之前
父節點
當前提交
4c2c686d3e
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      app/Core/Image.php

+ 3 - 3
app/Core/Image.php

@@ -88,12 +88,12 @@ class Image extends File
         if ($palette > 0 && ! \imagetruecolortopalette($image, true, $palette)) {
             throw new FileException('Failed to convert image to palette');
         }
-        if (false === \imagecopyresampled($image, $this->image, 0, 0, 0, 0, $width, $height, $oldW, $oldH)) {
-            throw new FileException('Failed to resize image');
-        }
         if (false === \imagealphablending($image, false) || false === \imagesavealpha($image, true)) {
             throw new FileException('Failed to adjust image');
         }
+        if (false === \imagecopyresampled($image, $this->image, 0, 0, 0, 0, $width, $height, $oldW, $oldH)) {
+            throw new FileException('Failed to resize image');
+        }
 
         $this->image = $image;