jiangqh hace 3 años
padre
commit
6760e8d828
Se han modificado 3 ficheros con 6 adiciones y 14 borrados
  1. 0 12
      src/Form/Field/Image.php
  2. 4 2
      src/Form/Field/ImageField.php
  3. 2 0
      src/Form/Field/UploadField.php

+ 0 - 12
src/Form/Field/Image.php

@@ -122,16 +122,4 @@ class Image extends File
 
         $this->uploadAndDeleteOriginalThumbnail($file);
     }
-
-    /**
-     * Destroy original files.
-     *
-     * @return void.
-     */
-    public function destroy()
-    {
-        parent::destroy();
-
-        $this->destroyThumbnail();
-    }
 }

+ 4 - 2
src/Form/Field/ImageField.php

@@ -132,7 +132,7 @@ trait ImageField
 
         if (is_array($file)) {
             foreach ($file as $f) {
-                $this->destroyThumbnail($f);
+                $this->destroyThumbnail($f, $force);
             }
 
             return;
@@ -188,7 +188,9 @@ trait ImageField
             }
         }
 
-        $this->destroyThumbnail();
+        if (! is_array($this->original)) {
+            $this->destroyThumbnail();
+        }
 
         return $this;
     }

+ 2 - 0
src/Form/Field/UploadField.php

@@ -394,6 +394,8 @@ trait UploadField
             return;
         }
 
+        $this->destroyThumbnail($paths);
+
         $storage = $this->getStorage();
 
         foreach ((array) $paths as $path) {