Giter VIP home page Giter VIP logo

uploadimgs's Introduction

uploadImgs

This plugin is using to preview imgs when we upload !

#HTML Structrue

<div id="pic">
	<img id="preview" src="../imgs/default.jpeg">
</div>
<input type="file" id="uploadBtn" accept="image/*" onchange="setPreviewPic()">

#Parameter configuration

######fileObj, //上传图片的input按钮 ######preview, //img标签 ######picWrap, //包裹着img的div ######maxImgSize, //最大的单张照片的值,单位为KB ######width,//照片显示的宽度 ######height//照片显示的高度

#Usage <script type="text/javascript" src="../js/singlePic.js"></script> <script> var fileObj=document.getElementById('uploadBtn'); var preview=document.getElementById('preview'); var picWrap=document.getElementById('pic'); fileObj.onchange=function(){ var obj=new SetPreviewPic(fileObj,preview,picWrap,100); //定义上传图片对象,参数分别为上传图片的input按钮、img标签包、裹着img的div、最大的单张照片的值,单位为KB obj.uploadSinglePic(200,250);//单张图片上传,参数分别为每张的宽度、高度 // obj.uploadPics(200,250,2); //多张图片上传,参数分别为每张的宽度、高度、最多上传张数 } </script>

uploadimgs's People

Contributors

luckywinty avatar

Stargazers

Jason avatar

Watchers

James Cloos avatar Jason 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.