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:39, 31 January 2024. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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 file
end