Index: trunk/phase3/resources/mediawiki.special/mediawiki.special.upload.js |
— | — | @@ -83,7 +83,7 @@ |
84 | 84 | } |
85 | 85 | |
86 | 86 | img.onload = function() { |
87 | | - var width, height, x, y, dx, dy; |
| 87 | + var width, height, x, y, dx, dy, logicalWidth, logicalHeight; |
88 | 88 | // Fit the image within the previewSizexpreviewSize box |
89 | 89 | if ( img.width > img.height ) { |
90 | 90 | width = previewSize; |
— | — | @@ -103,19 +103,27 @@ |
104 | 104 | case 0: |
105 | 105 | x = dx; |
106 | 106 | y = dy; |
| 107 | + logicalWidth = img.width; |
| 108 | + logicalHeight = img.height; |
107 | 109 | break; |
108 | 110 | case 90: |
109 | 111 | |
110 | 112 | x = dx; |
111 | 113 | y = dy - previewSize; |
| 114 | + logicalWidth = img.height; |
| 115 | + logicalHeight = img.width; |
112 | 116 | break; |
113 | 117 | case 180: |
114 | 118 | x = dx - previewSize; |
115 | 119 | y = dy - previewSize; |
| 120 | + logicalWidth = img.width; |
| 121 | + logicalHeight = img.height; |
116 | 122 | break; |
117 | 123 | case 270: |
118 | 124 | x = dx - previewSize; |
119 | 125 | y = dy; |
| 126 | + logicalWidth = img.height; |
| 127 | + logicalHeight = img.width; |
120 | 128 | break; |
121 | 129 | } |
122 | 130 | |
— | — | @@ -124,7 +132,7 @@ |
125 | 133 | ctx.drawImage( img, x, y, width, height ); |
126 | 134 | |
127 | 135 | // Image size |
128 | | - var info = mw.msg( 'widthheight', img.width, img.height ) + |
| 136 | + var info = mw.msg( 'widthheight', logicalWidth, logicalHeight ) + |
129 | 137 | ', ' + prettySize( file.size ); |
130 | 138 | $( '#mw-upload-thumbnail .fileinfo' ).text( info ); |
131 | 139 | }; |