Ver Fonte

Update ImageOptimizePipeline, do not optimize gifs

Daniel Supernault há 7 anos atrás
pai
commit
56b18f3e08

+ 4 - 1
app/Jobs/ImageOptimizePipeline/ImageUpdate.php

@@ -38,7 +38,10 @@ class ImageUpdate implements ShouldQueue
         $thumb = storage_path('app/'. $media->thumbnail_path);
         try {
             ImageOptimizer::optimize($thumb);
-            ImageOptimizer::optimize($path);
+            if($media->mime !== 'image/gif')
+            {
+                ImageOptimizer::optimize($path);
+            }
         } catch (Exception $e) {
             return;
         }

+ 4 - 0
app/Util/Media/Image.php

@@ -103,6 +103,10 @@ class Image {
     $ratio = $this->getAspectRatio($file, $thumbnail);
     $aspect = $ratio['dimensions'];
     $orientation = $ratio['orientation'];
+    if($media->mime === 'image/gif' && !$thumbnail)
+    {
+        return;
+    }
 
     try {
       $img = Intervention::make($file)->orientate();