From 78ca92c981cac676678f049728c7ab96f5783664 Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 18 Dec 2016 20:42:24 -0600 Subject: [PATCH] Fix upload image resizer. (fixes #1375, #2471) Polling the image height isn't reliable. Wait for the image to be fully downloaded before resizing it instead. --- app/assets/javascripts/uploads.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/assets/javascripts/uploads.js b/app/assets/javascripts/uploads.js index 5d5149938..f2b41337a 100644 --- a/app/assets/javascripts/uploads.js +++ b/app/assets/javascripts/uploads.js @@ -8,7 +8,7 @@ } if ($("#c-uploads").length) { - this.initialize_image(); + $("#image").load(this.initialize_image); this.initialize_info_bookmarklet(); this.initialize_similar(); $("#related-tags-button").trigger("click"); @@ -128,11 +128,6 @@ $("#scale").html("Scaled " + parseInt(100 * ratio) + "% (original: " + origin_width + "x" + origin_height + ")"); } }); - } else if (height === 0) { - if (!this.tries || this.tries < 10) { - this.tries = (this.tries || 0) + 1; - window.setTimeout(Danbooru.Upload.initialize_image, 200); - } } else { $("#scale").html("(original: " + width + "x" + height + ")"); }