From Wikimedia Commons, the free media repository
Jump to: navigation, search

{{#ifexist:Media:image_name.ext|then ...|otherwise ...}} - test is the file exist on
{{#ifexist:Image:image_name.ext|then ...|otherwise ...}} - test is the image page exist on the local wiki

See also this same test:

Tests: The 3 following tests of the function {{ifexist:}} are with existing pages and files.

  • yes, Media:首-seal.gif exist on - test with Media on + chinese character
  • yes, Image:首-seal.gif exist on this local wiki - test with Image on Commons + chinese character
  • yes, Image:Wikipedia.png exist on this local wiki - test with Image
  • yes, China exist - test with Article

Test 中, which exist as 六書通_中.gif and 中-bigseal.svg:

Result expected : 中-bigseal.svg

Test 首, which exist only as 六書通_首.gif:

Result expected : 首-seal.gif