Giter Club home page Giter Club logo

cupload's Introduction

cupload

基于原生js的图片上传插件

支持多图上传、选择预览、数量限制、像素限制、大小限制、图片删除、放大预览、图片排序、异步上传、编辑初始化图片

下载使用

下载:

git clone https://github.com/cuuuuuirz/cupload.git

使用:

引入js:

<script src="static/js/cupload.js"></script>

在需要的位置添加html:

<div id="cupload"></div>

实例化cupload对象:

<script type="text/javascript">
	var cupload = new Cupload ({
		ele: "#cupload"
	});
</script>

可选参数

//为方便比较和计算,部分参数为number型,已设置默认单位,不可再带单位。

{
	ele             : "#cupload",           // 实例化的DOM对象,必需
	name            : "image",              // 图片input的name名,非必需,默认为image
	num             : 1,                    // 可上传图片的数量,非必需,默认为1
	url             : "./upload.php",       // 异步上传url,非必需,无默认值
	width           : 148,                  // 预览框的宽,单位为px,非必需,默认为148
	height          : 148,                  // 预览框的高,单位为px,非必需,默认为148
	minSize         : 1024,                 // 图片大小最小限制,单位为KB,非必需,无默认值
	maxSize         : 2048,                 // 图片大小最大限制,单位为KB,非必需,无默认值
	limitedSize     : 2048,                 // 图片大小要求,单位为KB,非必需,无默认值
	minWidth        : 100,                  // 图片宽度最小限制,单位为px,非必需,无默认值
	minHeight       : 100,                  // 图片高度最小限制,单位为px,非必需,无默认值
	maxWidth        : 2000,                 // 图片宽度最大限制,单位为px,非必需,无默认值
	maxHeight       : 2000,                 // 图片高度最大限制,单位为px,非必需,无默认值
	limitedWidth    : 800,                  // 图片宽度要求,单位为px,非必需,无默认值
	limitedHeight   : 800,                  // 图片高度要求,单位为px,非必需,无默认值
	data            : ["1.png", "2.jpg"],   // 编辑模式下初始显示的图片路径,非必需,无默认值
}

cupload's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.