From 696a7895725a49834a73aa43b20c82a08f7e634f Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Tue, 20 Sep 2011 22:25:54 +0000 Subject: [PATCH] * (bug 31048) Fix for width/height reported on Special:Upload thumbnail for EXIF-rotated images Followup to r79867: switch the reported width/height as well as rotating the thumbnail image. This matches the logical width/height later seen when we complete the upload. --- .../mediawiki.special/mediawiki.special.upload.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/resources/mediawiki.special/mediawiki.special.upload.js b/resources/mediawiki.special/mediawiki.special.upload.js index 5a7e20ec4f..d6f6e52c2c 100644 --- a/resources/mediawiki.special/mediawiki.special.upload.js +++ b/resources/mediawiki.special/mediawiki.special.upload.js @@ -83,7 +83,7 @@ jQuery( function( $ ) { } img.onload = function() { - var width, height, x, y, dx, dy; + var width, height, x, y, dx, dy, logicalWidth, logicalHeight; // Fit the image within the previewSizexpreviewSize box if ( img.width > img.height ) { width = previewSize; @@ -103,19 +103,27 @@ jQuery( function( $ ) { case 0: x = dx; y = dy; + logicalWidth = img.width; + logicalHeight = img.height; break; case 90: x = dx; y = dy - previewSize; + logicalWidth = img.height; + logicalHeight = img.width; break; case 180: x = dx - previewSize; y = dy - previewSize; + logicalWidth = img.width; + logicalHeight = img.height; break; case 270: x = dx - previewSize; y = dy; + logicalWidth = img.height; + logicalHeight = img.width; break; } @@ -124,7 +132,7 @@ jQuery( function( $ ) { ctx.drawImage( img, x, y, width, height ); // Image size - var info = mw.msg( 'widthheight', img.width, img.height ) + + var info = mw.msg( 'widthheight', logicalWidth, logicalHeight ) + ', ' + prettySize( file.size ); $( '#mw-upload-thumbnail .fileinfo' ).text( info ); }; -- 2.20.1