Index: branches/wmf/1.18wmf1/extensions/VipsScaler/VipsScaler.i18n.php |
— | — | @@ -24,7 +24,10 @@ |
25 | 25 | 'vipsscaler-form-sharpen-radius' => 'Amount of sharpening:', |
26 | 26 | 'vipsscaler-form-bilinear' => 'Bilinear scaling', |
27 | 27 | 'vipsscaler-form-submit' => 'Generate thumbnails', |
28 | | - |
| 28 | + |
| 29 | + 'vipsscaler-thumbs-legend' => 'Generated thumbnails', |
| 30 | + 'vipsscaler-thumbs-help' => 'The thumbnail shown below was generated with the default scaler. Move your mouse over the thumbnail to compare it with the one generated by VIPS. Alternatively, you can click / unclick the checkbox below to switch between thumbnails.', |
| 31 | + 'vipsscaler-thumbs-switch-label' => 'Click to switch between default and VIPS scaling output.', |
29 | 32 | 'vipsscaler-default-thumb' => 'Thumbnail generated with default scaler', |
30 | 33 | 'vipsscaler-vips-thumb' => 'Thumbnail generated with VIPS', |
31 | 34 | |
— | — | @@ -117,7 +120,7 @@ |
118 | 121 | */ |
119 | 122 | $messages['de'] = array( |
120 | 123 | 'vipstest' => 'Testseite zur VIPS-Skalierung', |
121 | | - 'vipsscaler-desc' => 'Ermöglicht das Erstellen von Miniaturbildern mit VIPS', |
| 124 | + 'vipsscaler-desc' => 'Ermöglicht das Generieren von Miniaturbildern mit VIPS', |
122 | 125 | 'vipsscaler-invalid-file' => 'Die angeforderte Datei konnte nicht verarbeitet werden. Bitte überprüfen, ob Sie auf diesem Wiki vorhanden ist.', |
123 | 126 | 'vipsscaler-invalid-width' => 'Die Breite des Miniaturbildes sollte größer als Null und nicht größer als die Breite des Bildes sein.', |
124 | 127 | 'vipsscaler-invalid-sharpen' => 'Der Wert der Bildschärfe sollte größer als Null und kleiner als Fünf sein.', |
— | — | @@ -128,12 +131,15 @@ |
129 | 132 | 'vipsscaler-form-sharpen-radius' => 'Wert der Bildschärfe:', |
130 | 133 | 'vipsscaler-form-bilinear' => 'Bilineare Skalierung', |
131 | 134 | 'vipsscaler-form-submit' => 'Miniaturbild generieren', |
132 | | - 'vipsscaler-default-thumb' => 'Das Miniaturbild wurde mit dem Standardsaklierungsprogramm generiert.', |
| 135 | + 'vipsscaler-thumbs-legend' => 'Generierte Miniaturbilder', |
| 136 | + 'vipsscaler-thumbs-help' => 'Das unten angezeigte Miniaturbild wurde mit dem Standardskalierungsprogramm generiert. Bitte die Maus über das Miniaturbild bewegen, um es mit einer von VIPS generierten Version zu vergleichen. Alternativ kann man auch das Kästchen unten selektieren/deselektieren, um zwischen den Miniaturbildern zu wechseln.', |
| 137 | + 'vipsscaler-thumbs-switch-label' => 'Anklicken, um zwischen der Standardskalierung und der VIPS-Skalierung zu wechseln.', |
| 138 | + 'vipsscaler-default-thumb' => 'Das Miniaturbild wurde mit dem Standardskalierungsprogramm generiert.', |
133 | 139 | 'vipsscaler-vips-thumb' => 'Das Miniaturbild wurde mit VIPS generiert.', |
134 | 140 | 'vipsscaler-show-both' => 'Beide Miniaturbilder anzeigen', |
135 | 141 | 'vipsscaler-show-default' => 'Nur das Standardminiaturbild anzeigen', |
136 | 142 | 'vipsscaler-show-vips' => 'Nur das VIPS-Miniaturbild anzeigen', |
137 | | - 'right-vipsscaler-test' => 'Nutze das Testinterface zur VIPS-Skalierung [[Special:VipsTest]]', |
| 143 | + 'right-vipsscaler-test' => 'Das [[Special:VipsTest|Testinterface zur VIPS-Skalierung]] nutzen', |
138 | 144 | ); |
139 | 145 | |
140 | 146 | /** German (formal address) (Deutsch (Sie-Form)) |
— | — | @@ -191,6 +197,9 @@ |
192 | 198 | 'vipsscaler-form-sharpen-radius' => 'Cantidade de agudización:', |
193 | 199 | 'vipsscaler-form-bilinear' => 'Escala bilinear', |
194 | 200 | 'vipsscaler-form-submit' => 'Xerar a miniatura', |
| 201 | + 'vipsscaler-thumbs-legend' => 'Miniaturas xeradas', |
| 202 | + 'vipsscaler-thumbs-help' => 'A miniatura mostrada a continuación foi xerada coa escala por defecto. Desprace o rato por riba da miniatura para comparala con aquela xerada por VIPS. Como alternativa, pode marcar ou desmarcar a caixa de verificación inferior para alternar entre as miniaturas.', |
| 203 | + 'vipsscaler-thumbs-switch-label' => 'Preme para alternar entre a saída coa escala predeterminada e a de VIPS.', |
195 | 204 | 'vipsscaler-default-thumb' => 'Miniatura xerada coa escala por defecto', |
196 | 205 | 'vipsscaler-vips-thumb' => 'Miniatura xerada con VIPS', |
197 | 206 | 'vipsscaler-show-both' => 'Mostrar ambas as miniaturas', |
— | — | @@ -270,7 +279,10 @@ |
271 | 280 | */ |
272 | 281 | $messages['lb'] = array( |
273 | 282 | 'vipsscaler-desc' => 'Miniaturbiller mat VIPS maachen', |
| 283 | + 'vipsscaler-form-width' => 'Breet vum Miniatur-Bild:', |
274 | 284 | 'vipsscaler-form-file' => 'Fichier an dëser Wiki:', |
| 285 | + 'vipsscaler-form-submit' => 'Miniaturbiller generéieren', |
| 286 | + 'vipsscaler-show-both' => 'Déi zwee Miniatur-Biller wesien', |
275 | 287 | ); |
276 | 288 | |
277 | 289 | /** Macedonian (Македонски) |
— | — | @@ -289,6 +301,9 @@ |
290 | 302 | 'vipsscaler-form-sharpen-radius' => 'Изострување:', |
291 | 303 | 'vipsscaler-form-bilinear' => 'Билинеарно размерување', |
292 | 304 | 'vipsscaler-form-submit' => 'Создај минијатура', |
| 305 | + 'vipsscaler-thumbs-legend' => 'Создадени минијатури', |
| 306 | + 'vipsscaler-thumbs-help' => 'Долуприкажаната минијатура е создадена со стандардниот зададен резмерител. Ставете глушецот врз минијатурата за да ја споредите со онаа создадена од VIPS. Друг начин: можете да го штиклирате / отштиклирате кутивчето подолу за да се префрлите од една на друга минијатура.', |
| 307 | + 'vipsscaler-thumbs-switch-label' => 'Стиснете за да се префрлите од стандарден на VIPS размерен извод и обратно', |
293 | 308 | 'vipsscaler-default-thumb' => 'Минијатура создадена со основно-зададениот размерител', |
294 | 309 | 'vipsscaler-vips-thumb' => 'Минијатура создадена со VIPS', |
295 | 310 | 'vipsscaler-show-both' => 'Прикажи ги двете минијатури', |
— | — | @@ -320,7 +335,10 @@ |
321 | 336 | 'vipsscaler-form-file' => 'Bestand op deze wiki:', |
322 | 337 | 'vipsscaler-form-sharpen-radius' => 'Hoeveelheid verscherping:', |
323 | 338 | 'vipsscaler-form-bilinear' => 'Bilineair schalen', |
324 | | - 'vipsscaler-form-submit' => 'Miniatuur genereren', |
| 339 | + 'vipsscaler-form-submit' => 'Miniatuur aanmaken', |
| 340 | + 'vipsscaler-thumbs-legend' => 'Aangemaakte miniaturen', |
| 341 | + 'vipsscaler-thumbs-help' => 'De hieronder weergegeven miniatuurafbeelding is gegenereerd met de standaard schaler. Beweeg uw muis over de afbeelding om deze te vergelijken met degene die is gegenereerd met VIPS. U kunt ook klikken op het aanvinkvakje hieronder om te wisselen tussen de miniatuurafbeeldingen.', |
| 342 | + 'vipsscaler-thumbs-switch-label' => 'Klik hierop om te wisselen tussen standaard- en VIPS-schalingsuitvoer.', |
325 | 343 | 'vipsscaler-default-thumb' => 'Er is een miniatuurafbeelding aangemaakt met de standaard opschaler', |
326 | 344 | 'vipsscaler-vips-thumb' => 'Er is een miniatuurafbeelding aangemaakt met VIPS', |
327 | 345 | 'vipsscaler-show-both' => 'Beide miniatuurafbeeldingen weergeven', |
Index: branches/wmf/1.18wmf1/extensions/VipsScaler/SpecialVipsTest.php |
— | — | @@ -98,8 +98,8 @@ |
99 | 99 | # Make url to the vips thumbnail |
100 | 100 | $vipsThumbUrl = $this->getTitle()->getLocalUrl( $vipsUrlOptions ); |
101 | 101 | |
102 | | - # Add to output |
103 | | - $html = Html::rawElement( 'div', array( 'id' => 'mw-vipstest-thumbnails' ), |
| 102 | + # HTML for the thumbnails |
| 103 | + $thumbs = Html::rawElement( 'div', array( 'id' => 'mw-vipstest-thumbnails' ), |
104 | 104 | Html::element( 'img', array( |
105 | 105 | 'src' => $normalThumbUrl, |
106 | 106 | 'alt' => wfMessage( 'vipsscaler-default-thumb' ), |
— | — | @@ -109,6 +109,24 @@ |
110 | 110 | 'alt' => wfMessage( 'vipsscaler-vips-thumb' ), |
111 | 111 | ) ) |
112 | 112 | ); |
| 113 | + |
| 114 | + # Helper messages shown above the thumbnails rendering |
| 115 | + $help = wfMessage( 'vipsscaler-thumbs-help' )->parseAsBlock(); |
| 116 | + |
| 117 | + # A checkbox to easily alternate between both views: |
| 118 | + $checkbox = Xml::checkLabel( |
| 119 | + wfMessage( 'vipsscaler-thumbs-switch-label' ), |
| 120 | + 'mw-vipstest-thumbs-switch', |
| 121 | + 'mw-vipstest-thumbs-switch' |
| 122 | + ); |
| 123 | + |
| 124 | + # Wrap the three HTML snippets above in a fieldset: |
| 125 | + $html = Xml::fieldset( |
| 126 | + wfMessage( 'vipsscaler-thumbs-legend' ), |
| 127 | + $help . $checkbox . $thumbs |
| 128 | + ); |
| 129 | + |
| 130 | + # Finally output all of the above |
113 | 131 | $this->getOutput()->addHTML( $html ); |
114 | 132 | $this->getOutput()->addModules( array( |
115 | 133 | 'ext.vipsscaler', |
— | — | @@ -242,23 +260,23 @@ |
243 | 261 | # Validate title and file existance |
244 | 262 | $title = Title::makeTitleSafe( NS_FILE, $request->getText( 'thumb' ) ); |
245 | 263 | if ( is_null( $title ) ) { |
246 | | - return $this->streamError( 404 ); |
| 264 | + return $this->streamError( 404, "VipsScaler: invalid title\n" ); |
247 | 265 | } |
248 | 266 | $file = wfFindFile( $title ); |
249 | 267 | if ( !$file || !$file->exists() ) { |
250 | | - return $this->streamError( 404 ); |
| 268 | + return $this->streamError( 404, "VipsScaler: file not found\n" ); |
251 | 269 | } |
252 | 270 | |
253 | 271 | # Check if vips can handle this file |
254 | 272 | if ( VipsScaler::getVipsHandler( $file ) === false ) { |
255 | | - return $this->streamError( 500 ); |
| 273 | + return $this->streamError( 500, "VipsScaler: VIPS cannot handle this file type\n" ); |
256 | 274 | } |
257 | 275 | |
258 | 276 | # Validate param string |
259 | 277 | $handler = $file->getHandler(); |
260 | 278 | $params = array( 'width' => $request->getInt( 'width' ) ); |
261 | 279 | if ( !$handler->normaliseParams( $file, $params ) ) { |
262 | | - return $this->streamError( 500 ); |
| 280 | + return $this->streamError( 500, "VipsScaler: invalid parameters\n" ); |
263 | 281 | } |
264 | 282 | |
265 | 283 | |
Index: branches/wmf/1.18wmf1/extensions/VipsScaler/modules/ext.vipsScaler/ext.vipsScaler.css |
— | — | @@ -3,6 +3,9 @@ |
4 | 4 | margin-top: 1em; |
5 | 5 | margin-right: 1em; |
6 | 6 | } |
| 7 | +#mw-vipstest-thumbs-switch{ |
| 8 | + margin-bottom: 2em; |
| 9 | +} |
7 | 10 | .uc-caption { |
8 | 11 | /** Overrides ucompare caption position from bottom (bottom:10px) to top */ |
9 | 12 | top:10px; |
Index: branches/wmf/1.18wmf1/extensions/VipsScaler/modules/ext.vipsScaler/ext.vipsScaler.js |
— | — | @@ -1,40 +1,27 @@ |
2 | 2 | jQuery( function( $ ) { |
| 3 | + $.vipsScaler = { |
| 4 | + /** function to alternate between both thumbnails */ |
| 5 | + switchThumbs: function() { |
| 6 | + var e = $('#mw-vipstest-thumbnails'); |
| 7 | + var mask = e.children(".uc-mask"); |
| 8 | + var caption = e.children(".uc-caption"); |
| 9 | + |
| 10 | + width = e.width(); |
| 11 | + maskWidth = mask.width(); |
| 12 | + |
| 13 | + if( maskWidth < width / 2 ) { |
| 14 | + /** Bar is 3 pixels width. We want to show it on the right */ |
| 15 | + mask.width( width - 3); |
| 16 | + caption.html( e.children("img:eq(0)").attr("alt") ); |
| 17 | + } else { |
| 18 | + mask.width( 0 ); |
| 19 | + caption.html( e.children("img:eq(1)").attr("alt") ); |
| 20 | + } |
| 21 | + } |
| 22 | + }; |
| 23 | + |
3 | 24 | var container = document.getElementById( 'mw-vipstest-thumbnails' ); |
4 | 25 | if ( container ) { |
5 | | -/* |
6 | | - $( '<p id="mw-vipstest-buttons">\n' + |
7 | | - '<button id="mw-vipstest-show-both">' + |
8 | | - mediaWiki.message( 'vipsscaler-show-both' ).escaped() + |
9 | | - '</button> ' + |
10 | | - '<button id="mw-vipstest-show-default">' + |
11 | | - mediaWiki.message( 'vipsscaler-show-default' ).escaped() + |
12 | | - '</button> ' + |
13 | | - '<button id="mw-vipstest-show-vips">' + |
14 | | - mediaWiki.message( 'vipsscaler-show-vips' ).escaped() + |
15 | | - '</button> ' + |
16 | | - '</p>' |
17 | | - ).prependTo( container ); |
18 | | -*/ |
19 | | -/** |
20 | | - $( '#mw-vipstest-show-both' ).click( function() { |
21 | | - document.getElementById( 'mw-vipstest-show-default' ).style.display = 'inline'; |
22 | | - document.getElementById( 'mw-vipstest-show-vips' ).style.display = 'inline'; |
23 | | - document.getElementById( 'mw-vipstest-default-thumb' ).style.display = 'block'; |
24 | | - document.getElementById( 'mw-vipstest-vips-thumb' ).style.display = 'block'; |
25 | | - } ); |
26 | | - $( '#mw-vipstest-show-default' ).click( function() { |
27 | | - document.getElementById( 'mw-vipstest-show-default' ).style.display = 'none'; |
28 | | - document.getElementById( 'mw-vipstest-show-vips' ).style.display = 'inline'; |
29 | | - document.getElementById( 'mw-vipstest-default-thumb' ).style.display = 'block'; |
30 | | - document.getElementById( 'mw-vipstest-vips-thumb' ).style.display = 'none'; |
31 | | - } ); |
32 | | - $( '#mw-vipstest-show-vips' ).click( function() { |
33 | | - document.getElementById( 'mw-vipstest-show-default' ).style.display = 'inline'; |
34 | | - document.getElementById( 'mw-vipstest-show-vips' ).style.display = 'none'; |
35 | | - document.getElementById( 'mw-vipstest-default-thumb' ).style.display = 'none'; |
36 | | - document.getElementById( 'mw-vipstest-vips-thumb' ).style.display = 'block'; |
37 | | - } ); |
38 | | -**/ |
39 | 26 | /** |
40 | 27 | * options are detailed in upstream documentation available at |
41 | 28 | * http://www.userdot.net/files/jquery/jquery.ucompare/demo/ |
— | — | @@ -49,27 +36,20 @@ |
50 | 37 | defaultgap: 50, |
51 | 38 | leftgap: 0, |
52 | 39 | rightgap: 0, |
53 | | - caption: true, |
| 40 | + caption: false, |
54 | 41 | reveal: 0.5 |
55 | 42 | }); |
56 | 43 | |
57 | | - /** Also add a click handler to instantly switch beetween pics */ |
58 | | - $('#mw-vipstest-thumbnails').click( function() { |
59 | | - var e = $(this) |
60 | | - var mask = e.children(".uc-mask") |
61 | | - var caption = e.children(".uc-caption") |
62 | | - |
63 | | - width = e.width(); |
64 | | - maskWidth = mask.width(); |
65 | | - |
66 | | - if( maskWidth < width / 2 ) { |
67 | | - mask.width( width ); |
68 | | - caption.html( e.children("img:eq(0)").attr("alt") ); |
69 | | - } else { |
70 | | - mask.width( 0 ); |
71 | | - caption.html( e.children("img:eq(1)").attr("alt") ); |
72 | | - } |
73 | | - }); |
| 44 | + /** |
| 45 | + * Also add a click handler to instantly switch beetween pics |
| 46 | + * This can be done by clicking the thumbnail or using a checkbox |
| 47 | + */ |
| 48 | + $('#mw-vipstest-thumbs-switch').click( |
| 49 | + function() { $.vipsScaler.switchThumbs(); } |
| 50 | + ); |
| 51 | + $('#mw-vipstest-thumbnails').click( |
| 52 | + function() { $.vipsScaler.switchThumbs(); } |
| 53 | + ); |
74 | 54 | } |
75 | | -} |
| 55 | +} |
76 | 56 | ); |
Index: branches/wmf/1.18wmf1/extensions/VipsScaler/VipsScaler_body.php |
— | — | @@ -133,11 +133,16 @@ |
134 | 134 | |
135 | 135 | wfDebug( __METHOD__ . " rotating '{$file->getName()}' by {$rotation}°\n" ); |
136 | 136 | if ( empty( $options['bilinear'] ) ) { |
137 | | - # Calculate shrink factors. Offsetting by 0.5 pixels is required |
| 137 | + # Calculate shrink factors. Offsetting by a small amount is required |
138 | 138 | # because of rounding down of the target size by VIPS. See 25990#c7 |
139 | | - # No need to invert source and physical dimensions. They already got switched if needed. |
140 | | - $rx = $params['srcWidth'] / ($params['physicalWidth'] + 0.5); |
141 | | - $ry = $params['srcHeight'] / ($params['physicalHeight'] + 0.5); |
| 139 | + # |
| 140 | + # No need to invert source and physical dimensions. They already got |
| 141 | + # switched if needed. |
| 142 | + # |
| 143 | + # Use sprintf() instead of plain string conversion so that we can |
| 144 | + # control the precision |
| 145 | + $rx = sprintf( "%.18e", $params['srcWidth'] / ($params['physicalWidth'] + 0.125) ); |
| 146 | + $ry = sprintf( "%.18e", $params['srcHeight'] / ($params['physicalHeight'] + 0.125) ); |
142 | 147 | |
143 | 148 | wfDebug( sprintf( |
144 | 149 | "%s to shrink '%s'. Source: %sx%s, Physical: %sx%s. Shrink factors (rx,ry) = %sx%s.\n", |
Property changes on: branches/wmf/1.18wmf1/extensions/VipsScaler |
___________________________________________________________________ |
Added: svn:mergeinfo |
145 | 150 | Merged /branches/sqlite/extensions/VipsScaler:r58211-58321 |
146 | 151 | Merged /trunk/phase3/extensions/VipsScaler:r92580,92634,92713,92762,92765,92791,92854,92884,92886-92887,92894,92898,92907,92932,92958,93141,93149,93151,93233-93234,93258,93266,93303,93516-93518,93520,93818-93822,93847,93858,93891,93935-93936,94058,94062,94068,94107,94155,94235,94277,94346,94372,94422,94425,94444,94448,94456,94498,94517,94601,94630,94728,94738,94825,94862,94995-94997,95023,95042,95072-95073,95155,95327,95332,95410,95422,95426,95442,95468,95601,95812,98578,98598,98656 |
147 | 152 | Merged /branches/new-installer/phase3/extensions/VipsScaler:r43664-66004 |
148 | 153 | Merged /branches/REL1_15/phase3/extensions/VipsScaler:r51646 |
149 | 154 | Merged /branches/REL1_18/extensions/VipsScaler:r101758,103190 |
150 | 155 | Merged /branches/REL1_17/phase3/extensions/VipsScaler:r81445,81448 |
151 | 156 | Merged /trunk/extensions/VipsScaler:r99592,99653,100092,100419,100686,100692,100699,103669,104390-104603 |