Jump to content

Module:ImageRatio

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Adam Cuerden (talk | contribs) at 09:37, 31 January 2024 (After Module:Multiple image. May be horrifically broken). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

function ratio(image)
	local file = image and mw.title.new('File:' .. mw.uri.decode(mw.ustring.gsub(image,'%|.*$',''), 'WIKI'))
	file = file and file.file
	w = tonumber(file.width) or 1
	h = tonumber(file.height) or 1
    r = w/h
	return r
end