From: Michael Dale Date: Tue, 1 Sep 2009 18:57:28 +0000 (+0000) Subject: * fixed scaling issue on edit action. X-Git-Tag: 1.31.0-rc.0~39979 X-Git-Url: https://git.cyclocoop.org/%7B%7B%20url_for%28%27votes%27%2C%20votes=%27waiting%27%29%20%7D%7D?a=commitdiff_plain;h=f79dc1056b435d187b609b92d49e1b8e6efb3b04;p=lhc%2Fweb%2Fwiklou.git * fixed scaling issue on edit action. --- 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