Browse Source

upload 增加别名方法

xaboy 5 years ago
parent
commit
20cf96927c
1 changed files with 17 additions and 0 deletions
  1. 17 0
      src/UI/Iview/Traits/UploadFactoryTrait.php

+ 17 - 0
src/UI/Iview/Traits/UploadFactoryTrait.php

@@ -68,6 +68,7 @@ trait UploadFactoryTrait
      * @param string $action
      * @param string $value
      * @return Upload
+     * @deprecated
      */
     public static function uploadImageOne($field, $title, $action, $value = '')
     {
@@ -76,6 +77,22 @@ trait UploadFactoryTrait
     }
 
     /**
+     * 单图片上传
+     * value 为string类型
+     *
+     * @param string $field
+     * @param string $title
+     * @param string $action
+     * @param string $value
+     * @return Upload
+     */
+    public static function uploadImage($field, $title, $action, $value = '')
+    {
+        $upload = self::upload($field, $title, $action, (string)$value, Upload::TYPE_IMAGE);
+        return $upload->format(['jpg', 'jpeg', 'png', 'gif'])->accept('image/*')->maxLength(1);
+    }
+
+    /**
      * 单文件上传
      * value 为string类型
      *