赞
踩
今天要写上传图片功能,研究了一下cropper。将图片上传服务器并保存到本地
html
<html> <head> <title>基于cropper.js的图片裁剪</title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> <meta name="format-detection" content="telephone=no"> <link rel="stylesheet" href="/css/ImgCropping.css"> <link rel="stylesheet" href="/css/cropper.min.css"> </head> <body style="background: #eee"> <button id="replaceImg" class="l-btn">更换图片</button> <div style="width: 320px;height:136.23px;border: solid 1px #555;margin-top: 10px"> <img id="finalImg" name="file" src="" width="100%"> </div> <button type="button" onclick="update()">submit</button> <!--图片裁剪框 start--> <div style="display: none" class="tailoring-container"> <div class="black-cloth" onclick="closeTailor(this)"></div> <div class="tailoring-content"> <div class="tailoring-content-one"> <label title="上传图片" for="chooseImg" class="l-btn choose-btn"> <input type="file" accept="image/jpg,image/jpeg,image/png" name="file" id="chooseImg" class="hidden" onchange="selectImg(this)">
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。