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对象,而后面是要选择的 ...
随机推荐
- selenium谷歌火狐插件安装
1.首先ctrl+r进入终端输入(pip install selenium)进行python安装selenium2.打开百度浏览器进行分别输入geckodriver和Chromedriver对火狐和谷 ...
- Git命令之:git push
保护版权:转自,http://www.yiibai.com/git/git_push.html
- help_topic表,以字符拆分,一行转多行
help_topic表是数据库mysql下的一个表 SUBSTRING_INDEX(s, delimiter, number) 返回从字符串 s 的第 number 个 ...
- ERP和MES系统的区别和关系?
1.ERP和MES的区别:ERP(Enterprise Resources Planning)是企业资源计划,它是在物料需求计划MRP(Material Requirement Planning)和制 ...
- samba服务及vsftpd服务
如何配置多个网卡 第一步: 打开设置,选择网络驱动器添加 第二步: ip a 查看网卡是否添加成功 第三步: 打开刚添加的网卡配置文件(注意,你刚添加的网卡是没有配置文件的,需要去复制一份到/etc/ ...
- new、virtual、override
我们先看下面一段程序: public class Father { public void Run0() { Console.WriteLine("Father.Run0"); } ...
- Jmeter之cookie的处理方式,token处理
cookie是什么 由于http是无状态的协议,一旦客户端和服务器的数据交换完毕,就会断开连接,再次请求,会重新连接,这就说明服务器单从网络连接上是没有办法知道用户身份的.怎么办呢?那就给每次新的用户 ...
- linux如何判断上一条命令执行是否正确
echo $? 如果输出0代表结果正确 如果输出非0代表结果错误
- 解决:java compiler level does not match the version of the installed java project facet错误
java compiler level does not match the version of the installed java project facet错误的解决 因工作的关系,Eclip ...
- JAVA笔记14-线程
一.概念 线程:是一个程序里面不同的执行路径,每一个分支都叫线程.到现在为止我们所讲的程序分支只有一个,即main方法,称作主线程. 进程:class文件,exe文件.程序的执行过程:程序放入代码区( ...