Index: branches/REL1_18/phase3/includes/filerepo/File.php |
— | — | @@ -117,7 +117,7 @@ |
118 | 118 | * |
119 | 119 | * @param $old File Old file |
120 | 120 | * @param $new string New name |
121 | | - * |
| 121 | + * |
122 | 122 | * @return bool|null |
123 | 123 | */ |
124 | 124 | static function checkExtensionCompatibility( File $old, $new ) { |
— | — | @@ -217,7 +217,7 @@ |
218 | 218 | public function getFullUrl() { |
219 | 219 | return wfExpandUrl( $this->getUrl(), PROTO_RELATIVE ); |
220 | 220 | } |
221 | | - |
| 221 | + |
222 | 222 | public function getCanonicalUrl() { |
223 | 223 | return wfExpandUrl( $this->getUrl(), PROTO_CANONICAL ); |
224 | 224 | } |
— | — | @@ -475,7 +475,7 @@ |
476 | 476 | |
477 | 477 | /** |
478 | 478 | * Accessor for __get() |
479 | | - * |
| 479 | + * |
480 | 480 | * @return bool |
481 | 481 | */ |
482 | 482 | protected function getIsSafeFile() { |
— | — | @@ -891,10 +891,10 @@ |
892 | 892 | |
893 | 893 | /** |
894 | 894 | * Get the relative path for an archived file |
895 | | - * |
| 895 | + * |
896 | 896 | * @param $suffix bool|string if not false, the name of an archived thumbnail file |
897 | 897 | * |
898 | | - * @return string |
| 898 | + * @return string |
899 | 899 | */ |
900 | 900 | function getArchiveRel( $suffix = false ) { |
901 | 901 | $path = 'archive/' . $this->getHashPath(); |
— | — | @@ -909,7 +909,7 @@ |
910 | 910 | /** |
911 | 911 | * Get the relative path for an archived file's thumbs directory |
912 | 912 | * or a specific thumb if the $suffix is given. |
913 | | - * |
| 913 | + * |
914 | 914 | * @param $archiveName string the timestamped name of an archived image |
915 | 915 | * @param $suffix bool|string if not false, the name of a thumbnail file |
916 | 916 | */ |
Index: branches/REL1_18/phase3/includes/media/GIF.php |
— | — | @@ -14,7 +14,7 @@ |
15 | 15 | class GIFHandler extends BitmapHandler { |
16 | 16 | |
17 | 17 | const BROKEN_FILE = '0'; // value to store in img_metadata if error extracting metadata. |
18 | | - |
| 18 | + |
19 | 19 | function getMetadata( $image, $filename ) { |
20 | 20 | try { |
21 | 21 | $parsedGIFMetadata = BitmapMetadataHandler::GIF( $filename ); |
— | — | @@ -118,7 +118,7 @@ |
119 | 119 | wfSuppressWarnings(); |
120 | 120 | $metadata = unserialize($image->getMetadata()); |
121 | 121 | wfRestoreWarnings(); |
122 | | - |
| 122 | + |
123 | 123 | if (!$metadata || $metadata['frameCount'] <= 1) { |
124 | 124 | return $original; |
125 | 125 | } |
— | — | @@ -126,19 +126,19 @@ |
127 | 127 | /* Preserve original image info string, but strip the last char ')' so we can add even more */ |
128 | 128 | $info = array(); |
129 | 129 | $info[] = $original; |
130 | | - |
| 130 | + |
131 | 131 | if ( $metadata['looped'] ) { |
132 | 132 | $info[] = wfMsgExt( 'file-info-gif-looped', 'parseinline' ); |
133 | 133 | } |
134 | | - |
| 134 | + |
135 | 135 | if ( $metadata['frameCount'] > 1 ) { |
136 | 136 | $info[] = wfMsgExt( 'file-info-gif-frames', 'parseinline', $metadata['frameCount'] ); |
137 | 137 | } |
138 | | - |
| 138 | + |
139 | 139 | if ( $metadata['duration'] ) { |
140 | 140 | $info[] = $wgLang->formatTimePeriod( $metadata['duration'] ); |
141 | 141 | } |
142 | | - |
| 142 | + |
143 | 143 | return $wgLang->commaList( $info ); |
144 | 144 | } |
145 | 145 | } |
Index: branches/REL1_18/phase3/includes/media/Generic.php |
— | — | @@ -570,43 +570,43 @@ |
571 | 571 | |
572 | 572 | $srcWidth = $image->getWidth( $params['page'] ); |
573 | 573 | $srcHeight = $image->getHeight( $params['page'] ); |
574 | | - |
| 574 | + |
575 | 575 | if ( isset( $params['height'] ) && $params['height'] != -1 ) { |
576 | 576 | # Height & width were both set |
577 | 577 | if ( $params['width'] * $srcHeight > $params['height'] * $srcWidth ) { |
578 | 578 | # Height is the relative smaller dimension, so scale width accordingly |
579 | 579 | $params['width'] = wfFitBoxWidth( $srcWidth, $srcHeight, $params['height'] ); |
580 | | - |
| 580 | + |
581 | 581 | if ( $params['width'] == 0 ) { |
582 | 582 | # Very small image, so we need to rely on client side scaling :( |
583 | 583 | $params['width'] = 1; |
584 | 584 | } |
585 | | - |
| 585 | + |
586 | 586 | $params['physicalWidth'] = $params['width']; |
587 | 587 | } else { |
588 | 588 | # Height was crap, unset it so that it will be calculated later |
589 | 589 | unset( $params['height'] ); |
590 | 590 | } |
591 | 591 | } |
592 | | - |
| 592 | + |
593 | 593 | if ( !isset( $params['physicalWidth'] ) ) { |
594 | 594 | # Passed all validations, so set the physicalWidth |
595 | 595 | $params['physicalWidth'] = $params['width']; |
596 | 596 | } |
597 | | - |
| 597 | + |
598 | 598 | # Because thumbs are only referred to by width, the height always needs |
599 | 599 | # to be scaled by the width to keep the thumbnail sizes consistent, |
600 | 600 | # even if it was set inside the if block above |
601 | | - $params['physicalHeight'] = File::scaleHeight( $srcWidth, $srcHeight, |
| 601 | + $params['physicalHeight'] = File::scaleHeight( $srcWidth, $srcHeight, |
602 | 602 | $params['physicalWidth'] ); |
603 | 603 | |
604 | | - # Set the height if it was not validated in the if block higher up |
| 604 | + # Set the height if it was not validated in the if block higher up |
605 | 605 | if ( !isset( $params['height'] ) || $params['height'] == -1 ) { |
606 | 606 | $params['height'] = $params['physicalHeight']; |
607 | 607 | } |
608 | 608 | |
609 | | - |
610 | | - if ( !$this->validateThumbParams( $params['physicalWidth'], |
| 609 | + |
| 610 | + if ( !$this->validateThumbParams( $params['physicalWidth'], |
611 | 611 | $params['physicalHeight'], $srcWidth, $srcHeight, $mimeType ) ) { |
612 | 612 | return false; |
613 | 613 | } |