r97672 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97671‎ | r97672 | r97673 >
Date:22:25, 20 September 2011
Author:brion
Status:ok
Tags:
Comment:
* (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.
Modified paths:
  • /trunk/phase3/resources/mediawiki.special/mediawiki.special.upload.js (modified) (history)

Diff [purge]

Index: trunk/phase3/resources/mediawiki.special/mediawiki.special.upload.js
@@ -83,7 +83,7 @@
8484 }
8585
8686 img.onload = function() {
87 - var width, height, x, y, dx, dy;
 87+ var width, height, x, y, dx, dy, logicalWidth, logicalHeight;
8888 // Fit the image within the previewSizexpreviewSize box
8989 if ( img.width > img.height ) {
9090 width = previewSize;
@@ -103,19 +103,27 @@
104104 case 0:
105105 x = dx;
106106 y = dy;
 107+ logicalWidth = img.width;
 108+ logicalHeight = img.height;
107109 break;
108110 case 90:
109111
110112 x = dx;
111113 y = dy - previewSize;
 114+ logicalWidth = img.height;
 115+ logicalHeight = img.width;
112116 break;
113117 case 180:
114118 x = dx - previewSize;
115119 y = dy - previewSize;
 120+ logicalWidth = img.width;
 121+ logicalHeight = img.height;
116122 break;
117123 case 270:
118124 x = dx - previewSize;
119125 y = dy;
 126+ logicalWidth = img.height;
 127+ logicalHeight = img.width;
120128 break;
121129 }
122130
@@ -124,7 +132,7 @@
125133 ctx.drawImage( img, x, y, width, height );
126134
127135 // Image size
128 - var info = mw.msg( 'widthheight', img.width, img.height ) +
 136+ var info = mw.msg( 'widthheight', logicalWidth, logicalHeight ) +
129137 ', ' + prettySize( file.size );
130138 $( '#mw-upload-thumbnail .fileinfo' ).text( info );
131139 };

Follow-up revisions

RevisionCommit summaryAuthorDate
r97675MFT r97651, r97656, r97659 updated test cases for bug 6672, 31024...brion22:40, 20 September 2011
r97676Merge from REL1_18 r97675 -- exif rotation fixesbrion22:41, 20 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r79867Follow-up r79845: Add rotation support to the upload preview using the <canva...btongminh16:24, 8 January 2011

Status & tagging log