Преглед на файлове

使用缩略图,且对接OSS bug

$this->getStorage()->put()方法,不支持传递Image对象,
使用 $image->encode()->stream() 生成 Stream 流对象才可以
jorry有桥 преди 3 години
родител
ревизия
06aa6ca756
променени са 1 файла, в които са добавени 2 реда и са изтрити 2 реда
  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());
             }
         }