If the file doesn't exist, we get a whole bunch of cascading PHP errors.
authorChad Horohoe <demon@users.mediawiki.org>
Mon, 13 Apr 2009 15:05:47 +0000 (15:05 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Mon, 13 Apr 2009 15:05:47 +0000 (15:05 +0000)
includes/media/Bitmap.php

index c2f2458..76cc891 100644 (file)
@@ -191,6 +191,12 @@ class BitmapHandler extends ImageHandler {
                                return new MediaTransformError( 'thumbnail_error', $clientWidth, $clientHeight, $err );
                        }
 
+                       if ( !file_exists( $srcPath ) ) {
+                               $err = "File seems to be missing: $srcPath";
+                               wfDebug( "$err\n" );
+                               return new MediaTransformError( 'thumbnail_error', $clientWidth, $clientHeight, $err );
+                       }
+
                        $src_image = call_user_func( $loader, $srcPath );
                        $dst_image = imagecreatetruecolor( $physicalWidth, $physicalHeight );