Jump to content

Module:ImageRatio: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
After Module:Multiple image. May be horrifically broken
 
No edit summary
Line 5: Line 5:
h = tonumber(file.height) or 1
h = tonumber(file.height) or 1
r = w/h
r = w/h
return r
return file
end
end

Revision as of 09:39, 31 January 2024

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