Index: trunk/phase3/includes/media/Generic.php |
— | — | @@ -494,10 +494,10 @@ |
495 | 495 | if( file_exists( $dstPath ) ) { |
496 | 496 | $thumbstat = stat( $dstPath ); |
497 | 497 | if( $thumbstat['size'] == 0 || $retval != 0 ) { |
| 498 | + $result = unlink( $dstPath ); |
498 | 499 | wfDebugLog( 'thumbnail', |
499 | | - sprintf( 'Removing bad %d-byte thumbnail "%s"', |
500 | | - $thumbstat['size'], $dstPath ) ); |
501 | | - unlink( $dstPath ); |
| 500 | + sprintf( 'Removing bad %d-byte thumbnail "%s". unlink() result: %d', |
| 501 | + $thumbstat['size'], $dstPath, $result ) ); |
502 | 502 | return true; |
503 | 503 | } |
504 | 504 | } |
— | — | @@ -588,43 +588,43 @@ |
589 | 589 | |
590 | 590 | $srcWidth = $image->getWidth( $params['page'] ); |
591 | 591 | $srcHeight = $image->getHeight( $params['page'] ); |
592 | | - |
| 592 | + |
593 | 593 | if ( isset( $params['height'] ) && $params['height'] != -1 ) { |
594 | 594 | # Height & width were both set |
595 | 595 | if ( $params['width'] * $srcHeight > $params['height'] * $srcWidth ) { |
596 | 596 | # Height is the relative smaller dimension, so scale width accordingly |
597 | 597 | $params['width'] = self::fitBoxWidth( $srcWidth, $srcHeight, $params['height'] ); |
598 | | - |
| 598 | + |
599 | 599 | if ( $params['width'] == 0 ) { |
600 | 600 | # Very small image, so we need to rely on client side scaling :( |
601 | 601 | $params['width'] = 1; |
602 | 602 | } |
603 | | - |
| 603 | + |
604 | 604 | $params['physicalWidth'] = $params['width']; |
605 | 605 | } else { |
606 | 606 | # Height was crap, unset it so that it will be calculated later |
607 | 607 | unset( $params['height'] ); |
608 | 608 | } |
609 | 609 | } |
610 | | - |
| 610 | + |
611 | 611 | if ( !isset( $params['physicalWidth'] ) ) { |
612 | 612 | # Passed all validations, so set the physicalWidth |
613 | 613 | $params['physicalWidth'] = $params['width']; |
614 | 614 | } |
615 | | - |
| 615 | + |
616 | 616 | # Because thumbs are only referred to by width, the height always needs |
617 | 617 | # to be scaled by the width to keep the thumbnail sizes consistent, |
618 | 618 | # even if it was set inside the if block above |
619 | | - $params['physicalHeight'] = File::scaleHeight( $srcWidth, $srcHeight, |
| 619 | + $params['physicalHeight'] = File::scaleHeight( $srcWidth, $srcHeight, |
620 | 620 | $params['physicalWidth'] ); |
621 | 621 | |
622 | | - # Set the height if it was not validated in the if block higher up |
| 622 | + # Set the height if it was not validated in the if block higher up |
623 | 623 | if ( !isset( $params['height'] ) || $params['height'] == -1 ) { |
624 | 624 | $params['height'] = $params['physicalHeight']; |
625 | 625 | } |
626 | 626 | |
627 | | - |
628 | | - if ( !$this->validateThumbParams( $params['physicalWidth'], |
| 627 | + |
| 628 | + if ( !$this->validateThumbParams( $params['physicalWidth'], |
629 | 629 | $params['physicalHeight'], $srcWidth, $srcHeight, $mimeType ) ) { |
630 | 630 | return false; |
631 | 631 | } |