<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.roatpkz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AClean_image2</id>
	<title>Module:Clean image2 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.roatpkz.com/index.php?action=history&amp;feed=atom&amp;title=Module%3AClean_image2"/>
	<link rel="alternate" type="text/html" href="https://wiki.roatpkz.com/index.php?title=Module:Clean_image2&amp;action=history"/>
	<updated>2026-05-02T21:43:34Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.roatpkz.com/index.php?title=Module:Clean_image2&amp;diff=280&amp;oldid=prev</id>
		<title>Hefner: 1 revision imported</title>
		<link rel="alternate" type="text/html" href="https://wiki.roatpkz.com/index.php?title=Module:Clean_image2&amp;diff=280&amp;oldid=prev"/>
		<updated>2024-03-23T19:30:06Z</updated>

		<summary type="html">&lt;p&gt;1 revision imported&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 19:30, 23 March 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Hefner</name></author>
	</entry>
	<entry>
		<id>https://wiki.roatpkz.com/index.php?title=Module:Clean_image2&amp;diff=279&amp;oldid=prev</id>
		<title>Armadyl Godsword&gt;Riblet15: return table because lua does unexpected things with comma separated returns imo</title>
		<link rel="alternate" type="text/html" href="https://wiki.roatpkz.com/index.php?title=Module:Clean_image2&amp;diff=279&amp;oldid=prev"/>
		<updated>2019-03-11T05:48:33Z</updated>

		<summary type="html">&lt;p&gt;return table because lua does unexpected things with comma separated returns imo&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;-- Removes &amp;#039;File:&amp;#039; prefix, just in case&lt;br /&gt;
-- Replace {{!}} with | instead of preprocessing&lt;br /&gt;
-- Turn into a nice wiki file link&lt;br /&gt;
local p = {}&lt;br /&gt;
local defaultMaxSize = {&lt;br /&gt;
	h = 300,&lt;br /&gt;
	w = 300&lt;br /&gt;
}&lt;br /&gt;
p.main = function(frame)&lt;br /&gt;
	return p.clean(frame:getParent().args)&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
p.clean = function(args)&lt;br /&gt;
	local file = args.file&lt;br /&gt;
	if not file or (file and (file:lower() == &amp;#039;no&amp;#039; or file == &amp;#039;&amp;#039;)) then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
	if not file:find(&amp;#039;%[%[File:.-%]%]&amp;#039;) then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
	local fileRaw = file&lt;br /&gt;
	file = fileRaw:gsub(&amp;#039;%[&amp;#039;,&amp;#039;&amp;#039;):gsub(&amp;#039;%]&amp;#039;,&amp;#039;&amp;#039;):gsub(&amp;#039;[Ff]ile:&amp;#039;,&amp;#039;&amp;#039;):gsub(&amp;#039;{{!}}&amp;#039;,&amp;#039;|&amp;#039;)&lt;br /&gt;
	local fileParts = mw.text.split(file, &amp;#039;|&amp;#039;)&lt;br /&gt;
	file = fileParts[1]&lt;br /&gt;
	&lt;br /&gt;
	local filepage = mw.title.new(file, &amp;#039;File&amp;#039;)&lt;br /&gt;
	&lt;br /&gt;
	if not (filepage.exists and filepage.file.exists) then&lt;br /&gt;
		return nil&lt;br /&gt;
	end&lt;br /&gt;
	local aspect = filepage.file.width / filepage.file.height&lt;br /&gt;
	&lt;br /&gt;
	local maxSize = {&lt;br /&gt;
		h = tonumber(args.maxH) or defaultMaxSize.h,&lt;br /&gt;
		w = tonumber(args.maxW) or defaultMaxSize.w&lt;br /&gt;
	}&lt;br /&gt;
	local size = {&lt;br /&gt;
		h = filepage.file.height,&lt;br /&gt;
		w = filepage.file.width&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	-- iterate in reverse to preserve normal behaviour&lt;br /&gt;
	-- i.e. [[File:a.png|50px|100px]] will be 100px wide&lt;br /&gt;
	for i=#fileParts,2,-1 do&lt;br /&gt;
		local filePart = mw.text.trim(fileParts[i])&lt;br /&gt;
		if filePart:find(&amp;#039;%d+px&amp;#039;) then&lt;br /&gt;
			local mw,mh = filePart:match(&amp;#039;^(%d+)x(%d+)px$&amp;#039;)&lt;br /&gt;
			if mh and mw then&lt;br /&gt;
				size = {&lt;br /&gt;
					h = mh,&lt;br /&gt;
					w = mw&lt;br /&gt;
				}&lt;br /&gt;
			else&lt;br /&gt;
				mh = filePart:match(&amp;#039;^x(%d+)px$&amp;#039;)&lt;br /&gt;
				if mh then&lt;br /&gt;
					size.h = mh&lt;br /&gt;
				else&lt;br /&gt;
					mw = filePart:match(&amp;#039;^(%d+)px$&amp;#039;)&lt;br /&gt;
					if mw then&lt;br /&gt;
						size.w = mw&lt;br /&gt;
					end&lt;br /&gt;
				end&lt;br /&gt;
			end&lt;br /&gt;
			if size.h or size.w then&lt;br /&gt;
				break&lt;br /&gt;
			end&lt;br /&gt;
		end&lt;br /&gt;
	end&lt;br /&gt;
	local newSize = {}&lt;br /&gt;
	if size.h == nil and size.w == nil then&lt;br /&gt;
	end&lt;br /&gt;
	&lt;br /&gt;
	local newSize = {&lt;br /&gt;
		h = math.floor(math.min(filepage.file.height, maxSize.h, maxSize.w / aspect, size.h, size.w / aspect)),&lt;br /&gt;
		w = math.floor(math.min(filepage.file.width, maxSize.w, maxSize.h * aspect, size.w, size.h * aspect))&lt;br /&gt;
	}&lt;br /&gt;
	return {string.format(&amp;#039;[[File:%s|%sx%spx]]&amp;#039;, file, newSize.w, newSize.h), newSize.w, newSize.h}&lt;br /&gt;
end&lt;br /&gt;
return p&lt;/div&gt;</summary>
		<author><name>Armadyl Godsword&gt;Riblet15</name></author>
	</entry>
</feed>