張正
偶然
登入
隨譔
介紹韋那威其 Vi-na-uy-ki
𠳒否認
尋檢
䀡碼源𧵑模庉:Imagesize
←
模庉: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 local w, h = _getdimensions(filename) return w .. "x" .. h end function p.getHeight(frame) local filename = mw.text.trim(frame.args[1] or "") if filename == "" then return end local w, h = _getdimensions(filename) return h end function p.getWidth(frame) local filename = mw.text.trim(frame.args[1] or "") if filename == "" then return end local w, h = _getdimensions(filename) return w end function p.getScale(frame) local filename = mw.text.trim(frame.args[1] or "") if filename == "" then return end local scale = tonumber(frame.args.scale) or 1 local w, h = _getdimensions(filename) if (w == 0) or (h == 0) then return end return scale * w / h end return p
板㑄用𥪝張尼:
模庉:Imagesize/材料
(
䀡碼源
)
𢮿吏
模庉:Imagesize
。