Index: trunk/phase3/thumb.php |
— | — | @@ -69,22 +69,24 @@ |
70 | 70 | $thumb = false; |
71 | 71 | } |
72 | 72 | |
73 | | -if ( $thumb && $thumb->getPath() && file_exists( $thumb->getPath() ) ) { |
| 73 | +$errorMsg = false; |
| 74 | +if ( !$img ) { |
| 75 | + $errorMsg = wfMsg( 'badtitletext' ); |
| 76 | +} elseif ( !$thumb ) { |
| 77 | + $errorMsg = wfMsgHtml( 'thumbnail_error', 'File::transform() returned false' ); |
| 78 | +} elseif ( $thumb->isError() ) { |
| 79 | + $errorMsg = $thumb->getHtmlMsg(); |
| 80 | +} elseif ( !$thumb->getPath() ) { |
| 81 | + $errorMsg = wfMsgHtml( 'thumbnail_error', 'No path supplied in thumbnail object' ); |
| 82 | +} elseif ( $thumb->getPath() == $img->getPath() ) { |
| 83 | + $errorMsg = wfMsgHtml( 'thumbnail_error', 'Image was not scaled, ' . |
| 84 | + 'is the requested width bigger than the source?' ); |
| 85 | +} else { |
74 | 86 | wfStreamFile( $thumb->getPath() ); |
75 | | -} else { |
76 | | - if ( !$img ) { |
77 | | - $msg = wfMsg( 'badtitletext' ); |
78 | | - } elseif ( !$thumb ) { |
79 | | - $msg = wfMsgHtml( 'thumbnail_error', 'File::transform() returned false' ); |
80 | | - } elseif ( $thumb->isError() ) { |
81 | | - $msg = $thumb->getHtmlMsg(); |
82 | | - } elseif ( !$thumb->getPath() ) { |
83 | | - $msg = wfMsgHtml( 'thumbnail_error', 'No path supplied in thumbnail object' ); |
84 | | - } else { |
85 | | - $msg = wfMsgHtml( 'thumbnail_error', 'Output file missing' ); |
86 | | - } |
87 | | - thumbInternalError( $msg ); |
88 | 87 | } |
| 88 | +if ( $errorMsg !== false ) { |
| 89 | + thumbInternalError( $errorMsg ); |
| 90 | +} |
89 | 91 | |
90 | 92 | wfProfileOut( 'thumb.php-render' ); |
91 | 93 | wfProfileOut( 'thumb.php' ); |