Module:Infobox: Difference between revisions

Feel like I need an easier way to see if an image exists due to supporting the fallback individual images
Use media namespace so existence check works with shared repos
Line 37: Line 37:
if image == 'title' then
if image == 'title' then
local imageTitle = mw.title.new( 'File:' .. title .. '.png' )
local imageTitle = mw.title.new( 'Media:' .. title .. '.png' )
if imageTitle and imageTitle.exists then
if imageTitle and imageTitle.exists then
image = '[[File:' .. title .. '.png|' .. size .. ']]'
image = '[[File:' .. title .. '.png|' .. size .. ']]'