User:自宅警備員/Notes on the image placeholder

Previously
Just uses the file name, will follow default Fandom behavior for image files. Shows an image if it's there, shows a red link if it isn't. ニコララ (お兄ちゃんはおしまい！).png ニコララ (お兄ちゃんはおしまい！).png マーヤ (みつばちマーヤの冒険).png マーヤ (みつばちマーヤの冒険).png

First version


Uses the "#ifexist" parser function to check if the page (file) exists. If it exists, it will show the image. If it doesn't, it will show the "unknown - head.png" image instead, with a link to where the image should be uploaded. Parser functions are "expensive" and Fandom will limit them to 100 uses in a page, so "unknown - head.png" will replace every image after you hit the limit. Trying to find an alternative from the list of MediaWiki magic words:

Second version
msgnw (transclusion) will return the "article text" of the file, or " File:filename.png " if it's a PNG file that doesn't exist.

pos (string function) will look for the second text string inside the first text string and return its position if it's there or nothing if it's not.

It will only find ":File:" in files that don't exist, so it will be empty on files that exist. You can use that with the #if conditional function which checks if what you give it is empty or not by default. If it's empty, it will show the image. If it isn't, it will show the "unknown - head.png" image instead, with a link to where the image should be uploaded. Now it can do the same as on the first version, but avoiding the "#ifexist" function and also showing the image (or red link) anyway if something fails.