From f79dc1056b435d187b609b92d49e1b8e6efb3b04 Mon Sep 17 00:00:00 2001 From: Michael Dale Date: Tue, 1 Sep 2009 18:57:28 +0000 Subject: [PATCH] * fixed scaling issue on edit action. --- js2/mwEmbed/libAddMedia/remoteSearchDriver.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/js2/mwEmbed/libAddMedia/remoteSearchDriver.js b/js2/mwEmbed/libAddMedia/remoteSearchDriver.js index 23f1747956..2fcfba1fb1 100644 --- a/js2/mwEmbed/libAddMedia/remoteSearchDriver.js +++ b/js2/mwEmbed/libAddMedia/remoteSearchDriver.js @@ -636,7 +636,7 @@ remoteSearchDriver.prototype = { //deal with the api form upload form directly: $j('#upload_form').simpleUploadForm({ "api_target" : _this.upload_api_target , - "ondone_cb" : function( resultData ){ + "ondone_cb" : function( resultData ){ var wTitle = resultData['filename']; //add a loading div _this.addResourceEditLoader(); @@ -1118,7 +1118,13 @@ remoteSearchDriver.prototype = { //try and keep aspect ratio for the thumbnail that we clicked: - var tRatio = $j('#rsd_edit_img').width() / $j('#rsd_edit_img').height() ; + var rh = $j('#rsd_edit_img').height(); + var rw = $j('#rsd_edit_img').width(); + if( rw > rh ){ + var tRatio = rw / rh; + }else{ + var tRatio = rh / rw; + } if( ! tRatio ) var tRatio = 1; //set ratio to 1 if the width of the thumbnail can't be found for some reason -- 2.20.1