Skip to content

Commit

Permalink
Invoke the _renderPreview callback parameter directly if loadImage() …
Browse files Browse the repository at this point in the history
…returns false - Fixes blueimp#1007, Fixes blueimp#1008.
  • Loading branch information
blueimp committed Feb 13, 2012
1 parent 2730337 commit 8742ffd
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions js/jquery.fileupload-ui.js
Expand Up @@ -372,24 +372,26 @@
_renderPreview: function (file, node, callback) {
var that = this,
options = this.options;
loadImage(
file,
function (img) {
node.append(img);
// Force reflow:
that._reflow = $.support.transition &&
node[0].offsetWidth;
that._transitionCallback(
node.addClass('in'),
callback || $.noop
);
},
{
maxWidth: options.previewMaxWidth,
maxHeight: options.previewMaxHeight,
canvas: options.previewAsCanvas
}
);
if (!loadImage(
file,
function (img) {
node.append(img);
// Force reflow:
that._reflow = $.support.transition &&
node[0].offsetWidth;
that._transitionCallback(
node.addClass('in'),
callback || $.noop
);
},
{
maxWidth: options.previewMaxWidth,
maxHeight: options.previewMaxHeight,
canvas: options.previewAsCanvas
}
) && callback) {
callback();
}
},

_renderUpload: function (files) {
Expand All @@ -410,7 +412,9 @@
that._renderPreview(
file,
previewNode,
deferred.resolve
function () {
deferred.resolveWith(that);
}
);
return deferred.promise();
});
Expand Down

0 comments on commit 8742ffd

Please sign in to comment.