From 8c57476667bfab1a901d78a5827f4106171be968 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Wed, 29 Jul 2015 17:43:35 -0700 Subject: [PATCH] potential fix for #1375: The preview image on the upload page is sometimes displayed at full size --- app/assets/javascripts/uploads.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/uploads.js b/app/assets/javascripts/uploads.js index d08b7bb0f..89b45f56e 100644 --- a/app/assets/javascripts/uploads.js +++ b/app/assets/javascripts/uploads.js @@ -107,7 +107,7 @@ Danbooru.Upload.initialize_image = function() { var $image = $("#image"); - if ($image.size() > 0) { + if ($image.length) { var height = $image.height(); var width = $image.width(); if (height > 400) { @@ -128,6 +128,9 @@ $("#scale").html("Scaled " + parseInt(100 * ratio) + "% (original: " + origin_width + "x" + origin_height + ")"); } }); + } else if (!this.retried) { + this.retried = true; + window.setTimeout(Danbooru.Upload.initialize_image, 200); } } }