䀡碼源𧵑模庉:Imagesize
伴空得權𢯢𢷮張尼、爲理由𢖖󠄁:
伴吻固体䀡吧抄劄碼源𧵑張尼。
--[[
Imagesize
taks a single unnamed parameter, the filename
returns its dimensions as a string "WIDTHxHEIGHT"
Adaped from the original function in Module:Multiple image
--]]
local p = {}
local function _getdimensions(filename)
if filename:sub(1,5) ~= "File:" then filename = "File:" .. filename end
local titleobj = mw.title.new(mw.uri.decode(mw.ustring.gsub(filename,'%|.*$',''), 'WIKI'))
local fileobj = titleobj and titleobj.file or {width = 0, height = 0}
local w = tonumber(fileobj.width) or 0
local h = tonumber(fileobj.height) or 0
return w, h
end
function p.getDimensions(frame)
local filename = mw.text.trim(frame.args[1] or "")
if filename == "" then return end
000
1:0
板㑄用𥪝張尼:
𢮿吏模庉:Imagesize。