0 Star 0 Fork 0

cc_01 / uplaodImg

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

imgfunc

介绍

图片压缩上传

软件架构

软件架构说明

安装教程

  1. npm install imgfunc
  2. <script src="@imgfunc/dist/index.min.js"></script>

使用说明

import UploadImg from 'imgfunc';
UploadImg({
   fileType: /\/(?:jpeg|png|gif|jpg)/i, // 上传图片类型限制
    changeType: "image/jpeg", // 后台需要的图片类型,方便压缩默认全部转jpeg
    elem: null, // input type="file" 节点,用来获取文件
    base64: null, // 图片文件 database64,一般是非input 获取的文件传
    maxSize: 2*1024*1024, // 图片文件最大值 以字节(B)为单位 。默认 2M
    multiple:false,// 是否多文件(暂不支持)
    uploadUrl, // 上传地址
    xhrParam, // 上传所需参数,必须是 Object
    uploadTimeout:60, // 超时时间(只计算执行接口的超时)
    formdataName, // 上传文件的name
    beforeUpload, // 上传前调用事件,此方法可以拦截上传,以及获取图片base64
    uploading,// 正在执行上传事件
    successUpload, // 上传成功回调
    errorUpload, // 上传失败回调
    fileName:'blob', // 上传文件名称 用于new FormDate() append方法第三个参数, default:'blob'
})

参与贡献

  1. Fork 本仓库
MIT License Copyright (c) 2020 cc_01 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

图片上传 展开 收起
JavaScript
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/xunyu/uplaodImg.git
git@gitee.com:xunyu/uplaodImg.git
xunyu
uplaodImg
uplaodImg
master

搜索帮助