this.$clone = $clone = $('<img>');
$clone.one('load', $.proxy(function () {
var naturalWidth = $clone.prop('naturalWidth') || $clone.width(),
naturalHeight = $clone.prop('naturalHeight') || $clone.height();
this.image = {
naturalWidth: naturalWidth,
naturalHeight: naturalHeight,
aspectRatio: naturalWidth / naturalHeight,
rotate: 0
};
this.url = url;
this.ready = true;
this.build();
}, this)).one('error', function () {
$clone.remove();
}).attr({
// crossOrigin: crossOrigin, // "crossOrigin" must before "src" (#271)
src: bustCacheUrl || url
});
注释掉那行crossOrigin就好了,还不清楚是什么作用
本文详细介绍了如何使用JavaScript处理图片加载,并在图片加载完成后获取其自然宽度、高度、旋转角度以及构建图片对象的过程。通过实例演示了如何避免使用crossOrigin属性可能带来的问题,确保图片加载和信息收集的顺利进行。
2772

被折叠的 条评论
为什么被折叠?



