jquery.fileupload-image-editor.js 中actions.resizeImage
https://github.com/ChuckForkJS/jQuery-File-Upload/blob/master/js/jquery.fileupload-image-editor.js
actions.resizeImage(data, resizeOptions).then(function () {
var imageOptions = { imagePreviewName: options.imagePreviewName };
actions.setImage(data, imageOptions);
actions.deleteImageReferences(data, {});
// Replace preview image
data.context.find('.preview').each(function (index, elm) {
$(elm).empty();
$(elm).append(data.files[index].preview);
});
data.context.find('.size').text(
thiz._formatFileSize(data.files[].size)
);
data.context.find('.name').text(
data.files[].name
);
$editor.modal('hide');
});
先触发了jquery.fileupload-image.js中的resizeImage方法
// Resizes the image given as data.canvas or data.img
// and updates data.canvas or data.img with the resized image.
// Also stores the resized image as preview property.
// Accepts the options maxWidth, maxHeight, minWidth,
// minHeight, canvas and crop:
resizeImage: function (data, options) {
if (options.disabled || !(data.canvas || data.img)) {
return data;
}
options = $.extend({canvas: true}, options);
var that = this,
dfd = $.Deferred(),
img = (options.canvas && data.canvas) || data.img,
resolve = function (newImg) {
if (newImg && (newImg.width !== img.width ||
newImg.height !== img.height ||
options.forceResize)) {
data[newImg.getContext ? 'canvas' : 'img'] = newImg;
}
data.preview = newImg;
dfd.resolveWith(that, [data]);
},
thumbnail;
if (data.exif) {
if (options.orientation === true) {
options.orientation = data.exif.get('Orientation');
}
if (options.thumbnail) {
thumbnail = data.exif.get('Thumbnail');
if (thumbnail) {
loadImage(thumbnail, resolve, options);
return dfd.promise();
}
}
// Prevent orienting the same image twice:
if (data.orientation) {
delete options.orientation;
} else {
data.orientation = options.orientation;
}
}
if (img) {
resolve(loadImage.scale(img, options));
return dfd.promise();
}
return data;
},
jquery.fileupload-image-editor.js 中actions.resizeImage的更多相关文章
- jQuery 对AMD的支持(Require.js中如何使用jQuery)
AMD 模块 AMD(异步模块定义,Asynchronous Module Definition)格式总体的目标是为现在的开发者提供一个可用的模块化 JavaScript 的解决方案. AMD 模块格 ...
- jQuery FileUpload等插件的使用实例
1.jQuery FileUpload 需要的js: jquery.js jquery.fileupload.js jquery.iframe-transport.js jquery.xdr-tran ...
- prototype.js 和 jQuery.js中 ajax 的使用
这次还是prototype.js 和 jQuery.js冲突的问题,前面说到过解决办法http://www.cnblogs.com/Joanna-Yan/p/4836252.html,以及上网说的大部 ...
- jQuery 互相调用iframe页面中js的方法
1,子iframe内调用父类函数方法: window.parent.func(); 2,子Iframe中获取父界面的元素: $("#xx", window.parent.docum ...
- 另一种图片上传 jquery.fileupload.js
今天遇到另外一种上传图片方法 用jquery.fileupload.js <input type="file" name="file[]" multipl ...
- 文件上传时jquery.form.js中提示form.submit SCRIPT5: 拒绝访问
利用其它控件触发file的click事件来选择文件后,使用jquery.form.js中的submit方法提交时IE报错:form.submit SCRIPT5: 拒绝访问,其它浏览器正常, < ...
- jquery中的each用法以及js中的each方法实现实例
each()方法能使DOM循环结构简洁,不容易出错.each()函数封装了十分强大的遍历功能,使用也很方便,它可以遍历一维数组.多维数组.DOM, JSON 等等在javaScript开发过程中使用$ ...
- 【jQuery】JS中拼接URL发送GET请求的中文、特殊符号的问题
> 参考的优秀文章 jQuery ajax - param() 方法 经常,我们需要在JS中拼接URL然后以GET形式提交请求.如果遇到中文.特殊符号则需要作各种处理. jQuery有一个方法非 ...
- JQuery之append和appendTo的区别,还有js中的appendChild用法
JQuery之append和appendTo的区别 append()前面是要选择的对象,后面是要在对象内插入的元素内容 appendTo()前面是要插入的元素内容且为Jquery对象,而后面是要选择的 ...
随机推荐
- Almost Increasing Array CodeForces - 946G (dp)
大意: 定义几乎递增序列为删除不超过一个数后序列严格递增. 给定序列, 求最少改变多少个数能变为几乎递增序列. 跟hdu5256类似,
- jackson json序列化 首字母大写 第二个字母需小写
有这样一个类: @Setter @Getter @JsonNaming(value = PropertyNamingStrategy.UpperCamelCaseStrategy.class) pub ...
- wex5 sqllite本地数据库的运用
http://doc.wex5.com/?p=3774 需要引入包require("cordova!com.brodysoft.sqlitePlugin"); //本地数据库操作 ...
- Ubuntu安装openssh安装ssh、 免密登录、 创建新用户并免密登录
一.安装openssh sudo apt-get install openssh-server ssh localhost 二.免密登录 cd ~/.ssh ssh-keygen ...
- CentOS 设置 yum源
什么是 yum Yum(全称 Yellow Dog Updater)是一个在 Fedora 和 RedHat 以及 CentOS 中的 Shell 前端软件包管理器.基于 RPM 包管理,能够从指定的 ...
- JSP的9大内置对象和4打作用域对象
一.9大内置对象 二.4大内置作用域对象
- lnmp1.4 nginx配置thinkphp5
vhost/xxx.conf配置图,重点是红色框框 研究了两三天 ,至此thinkphp5 路由,隐藏index.php全部解决 感谢网友的分享:http://blog.csdn.net/gaoxiu ...
- PDF转图片,在线PDF转JPG/PNG
[在线DEMO](https://oktools.net/pdf2img) 原理 使用pdf.js预览图片,pdf.js将pdf通过canvas将每一页渲染出来,然后我们通过canvas的toData ...
- xml的解析及案例的分析和分享
HTML的文档如下: <!DOCTYPE html> <html lang="zh-CN"> <head> <meta charset=& ...
- 2019-2020-1 20199319《Linux内核原理与分析》第三周作业
操作系统是如何工作的 基础知识 1.计算机的三个法宝:存储程序计算机.函数调用堆栈机制.中断. 2.堆栈的具体作用:记录函数调用框架.传输函数参数.保存返回值的地址.提供函数内部局部变量的存储空间. ...