Jelajahi Sumber

使用缩略图,且对接OSS bug

$this->getStorage()->put()方法,不支持传递Image对象,
使用 $image->encode()->stream() 生成 Stream 流对象才可以
jorry有桥 3 tahun lalu
induk
melakukan
06aa6ca756
1 mengubah file dengan 2 tambahan dan 2 penghapusan
  1. 2 2
      src/Form/Field/ImageField.php

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

@@ -182,9 +182,9 @@ trait ImageField
             });
 
             if (! is_null($this->storagePermission)) {
-                $this->getStorage()->put("{$this->getDirectory()}/{$path}", $image->encode(), $this->storagePermission);
+                $this->getStorage()->put("{$this->getDirectory()}/{$path}", $image->encode()->stream(), $this->storagePermission);
             } else {
-                $this->getStorage()->put("{$this->getDirectory()}/{$path}", $image->encode());
+                $this->getStorage()->put("{$this->getDirectory()}/{$path}", $image->encode()->stream());
             }
         }