Index: extensions/ParserFunctions/ParserFunctions.php =================================================================== --- extensions/ParserFunctions/ParserFunctions.php (revision 17981) +++ extensions/ParserFunctions/ParserFunctions.php (arbetskopia) @@ -163,6 +163,17 @@ function ifexist( &$parser, $title = '', $then = '', $else = '' ) { $title = Title::newFromText( $title ); + + /* If namespace is specified as NS_MEDIA, then we want to check the physical file, + * not the "description" page. + */ + if( $title->getNamespace() == NS_MEDIA ) { + + $image = new Image( $title ); + return is_object( $image ) && $image->exists() ? $then : $else; + + } + return is_object( $title ) && $title->exists() ? $then : $else; }