Module:Image

local getArgs = require('Module:Arguments').getArgs local string = require('Module:String') p = {}

function p.clearImage(frame) args = getArgs(frame) return p._clearImage(args[1] or args['image'], args[2] or args['size']) end

function p._clearImage(img, size) local fr = mw.getCurrentFrame img = img and (img:gsub('^File:',) .. (img:match('%.%a%a%a?%a?$') and  or '.png')) or '' -- check for proper file extension img = fr:callParserFunction( 'filepath', { img, size } ) if img ~= "" then img = img:gsub('%?cb=%d+','') return img..'?format=original' else return string.wrapHtml( 'Bad file name '..img, 'p', { class="error", style="font-weight: bold;" } ) end end

return p