GitHub地址:
前台图片压缩处理:
<div>
小图片:
<img id="imgOne" style="border:1px solid gray;" />
</div>
<div>
大图片:
<img id="imgTwo" style="border:1px solid gray;" />
</div>
<script type="text/javascript">
/*
* 简单上传图片,并保存到相关文件夹
* 默认自动移动到指定的子文件夹
*/
var uploader = $('#uploadBtn').uploader({
url: '../ashx/upload3.0.ashx',
fileTypeExts: 'jpg;png',
text: '选择图片',
type: 'imgdouble',
subFolder: 'test',
isAutoMove:true,//指定是否自动移动到上传文件夹
maxSize: 1024 * 1000,
onSuccess: function (data) {
//$('#imgOne').attr('src', '/content/tempfile/' + data.imgSmall);
//$('#imgTwo').attr('src', '/content/tempfile/' + data.imgBig);
$('#imgOne').attr('src', '/content/uploadfiles/' + data.imgSmall);
$('#imgTwo').attr('src', '/content/uploadfiles/' + data.imgBig);
}
});
</script>