From 72922e26f393147f5642e11a972f5d5e4fde17f5 Mon Sep 17 00:00:00 2001 From: Type-kun Date: Wed, 17 Apr 2013 13:29:51 +0600 Subject: [PATCH] Update uploads.js fixes #1358 --- app/assets/javascripts/uploads.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/app/assets/javascripts/uploads.js b/app/assets/javascripts/uploads.js index 4c09a1866..eeaa9ddac 100644 --- a/app/assets/javascripts/uploads.js +++ b/app/assets/javascripts/uploads.js @@ -83,6 +83,19 @@ $image.height(height * ratio); $image.width(width * ratio); $("#scale").html("Scaled " + parseInt(100 * ratio) + "% (original: " + width + "x" + height + ")"); + $image.resizable({ + maxHeight: height, + maxWidth: width, + aspectRatio: width/height, + handles: "e, s, se", + resize: function( event, ui ){ + var origin_width = ui.element.resizable("option","maxWidth"); + var origin_height = ui.element.resizable("option","maxHeight"); + var height = ui.size.height; + var ratio = height/origin_height; + $("#scale").html("Scaled " + parseInt(100 * ratio) + "% (original: " + origin_width + "x" + origin_height + ")"); + } + }); } } }