Code Monkey home page Code Monkey logo

ajax-upload-image.mobile's Introduction

ajax-upload-image.mobile

移动端异步上传图片demo

demo预览

上传图片

图片操作

如何使用?

  1. demo/index.html中样例所示,引入如下js
<script type="text/javascript" src="../lib/exif.js"></script>
<script type="text/javascript" src="../js/wrapper.js"></script>
<script type="text/javascript" src="../js/upload_image.js"></script>

exif.js是一个开源的读取图像的原始数据的功能扩展js,用于处理ios设备拍照上传存在的图片旋转问题

wrapper.js创建遮罩层简单js

upload_image.js图片展示操作依赖wrapper.js

  1. 创建imageUpload
//当前已上传图片张数
var i = function(){
    	return $("img.preview").length;
    }
    
new ImageUploader($(".upload-area"),{
	    	uploaderUrl:uploaderUrl,
	    	inputName:"imgs",
	    	beforeComplete:function(){
	    		$('#submitBtn').attr('disabled',true);
	    	},
	    	afterComplete: function() {
	    		$('#submitBtn').attr('disabled',false);
	    		if(i() > 0){
	    			$(".J_Showmeonfileuploaded").hide()
	    		}
	    		if(5 === i()){
	    			$(".upload-btn").hide();
	    		}
	        }
    });
  1. 配置参数
{
	inputName: "img",//input名,用于构造表单提交数据
	onlyShow: !1, //是否只查看
	uploadBtn: ".J_UploadBtn",//图片上传按钮
	fileInput: ".J_FileInput",//图片inputfile
	prevClass: "preview",//所有上传成功并显示的图片都会添加此类(可统计当前已上传图片张数)
	uploaderUrl: "",//图片上传url地址
	deleteUrl: "",//删除图片url地址
	limitSize: 5, //图片大小限制 5M
	limitNum: 5, //图片数量限制
	beforeComplete: function() {},//图片上传前回调函数
	afterComplete: function() {}//图片上传完成回调函数
}

ajax-upload-image.mobile's People

Contributors

monster-l avatar lcp0578 avatar

Stargazers

 avatar gojang avatar Matt Ma avatar  avatar 白山羊 avatar  avatar onlyhom avatar Zhiqian Liang avatar Roderick Berge avatar lcaminy avatar 许委 avatar leec avatar Bobo avatar  avatar

Watchers

James Cloos avatar RongJie avatar  avatar wz avatar

ajax-upload-image.mobile's Issues

图片在安卓机上不能显示

您好,现在做的移动端网站,我在chromeshan上调试ok,微信开发者工具也可以的,但在安卓机上选择图片后没任何反应,想知道咋回事

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.