wfProfileIn( 'thumb.php-render' );
$img = Image::newFromName( $fileName );
-if ( $img ) {
- if ( ! is_null( $page ) ) {
- $img->selectPage( $page );
+try {
+ if ( $img ) {
+ if ( ! is_null( $page ) ) {
+ $img->selectPage( $page );
+ }
+ $thumb = $img->renderThumb( $width, false );
+ } else {
+ $thumb = false;
}
- $thumb = $img->renderThumb( $width, false );
-} else {
+} catch( Exception $ex ) {
+ // Tried to select a page on a non-paged file?
$thumb = false;
}
} else {
$badtitle = wfMsg( 'badtitle' );
$badtitletext = wfMsg( 'badtitletext' );
+ header( 'Cache-Control: no-cache' );
+ header( 'Content-Type: text/html' );
echo "<html><head>
<title>$badtitle</title>
<body>
<h1>$badtitle</h1>
<p>$badtitletext</p>
-</body></html>";
+</body></html>
+";
}
wfProfileOut( 'thumb.php-render' );