As AI crawling and training continues to stress the web, the Wikimedia foundation continues to change various things in their edge rules and internal processes. Recently the Wikimedia Hackathon Northwestern Europe 2026 was likely one of the largest technical events organized after some of the new rate limits came into play, and it wasn’t without issue at the event (though we got by).
Image thumbnails are a bit of a different story, and the backend service has been restricted to the number of thumbnail sizes that can be generated, stored and served, with some new defaults put in place.
Current standard sizes in Wikimedia production: 20px, 40px, 60px, 120px, 250px, 330px, 500px, 960px, 1280px, 1920px, 3840px
Common thumbnail sizes
If you want to read some of the research and decisions that went into it, take a look at T211661#8377883 and other linked tickets.
Anyway, these changes lead to some posts on my blog, which used now non supported thumbnail sizes to fail to load said thumbnails.

Instead of getting the image (or any image at all), the requests is instead served with an error page from the edge, with a link for further information, which also happens to be a 429 response. Though it appears there are no headers around retrying the request.
Error
Use thumbnail steps listed on https://w.wiki/GHai. Please contact noc@wikimedia.org for further information (a765913)
In this particular blog post, the image being used is https://upload.wikimedia.org/wikipedia/commons/thumb/9/90/Wikimedia_Hackathon_Amsterdam_2013.svg/250px-Wikimedia_Hackathon_Amsterdam_2013.svg.png
The fullsize URL would be https://upload.wikimedia.org/wikipedia/commons/9/90/Wikimedia_Hackathon_Amsterdam_2013.svg, and the “240px x 240px” thumbnail size now actually directs you to a 250px thumbnail with a slightly different size… https://upload.wikimedia.org/wikipedia/commons/thumb/9/90/Wikimedia_Hackathon_Amsterdam_2013.svg/250px-Wikimedia_Hackathon_Amsterdam_2013.svg.png
The Regex
I’m going to try and take a similar approach to my Imgur UK fix a few weeks ago and see if I can just rewrite these live as pages are served on the WordPress backend using Real-Time Find and Replace (just in case they again all need tweaking in the future…
Rather than had crafting this, I put together a prompt for Google Gemini:
The wikimedia foundation has changed their standard thumbnail sizes...
Current standard sizes in Wikimedia production: 20px, 40px, 60px, 120px, 250px, 330px, 500px, 960px, 1280px, 1920px, 3840px
These differ from what used to be used, an thus what I have used in my blog posts in the past.
I have URLS such as https://upload.wikimedia.org/wikipedia/commons/thumb/9/90/Wikimedia_Hackathon_Amsterdam_2013.svg/250px-Wikimedia_Hackathon_Amsterdam_2013.svg.png
which needs to be rewritten to the next thumb size up...
The fullsize URL would be https://upload.wikimedia.org/wikipedia/commons/9/90/Wikimedia_Hackathon_Amsterdam_2013.svg, and the "240px x 240px" thumbnail size now actually directs you to a 250px thumbnail with a slightly different size... https://upload.wikimedia.org/wikipedia/commons/thumb/9/90/Wikimedia_Hackathon_Amsterdam_2013.svg/250px-Wikimedia_Hackathon_Amsterdam_2013.svg.png
And likely any thumbnail of above 3840px should just be rewritten to the FULL SIZE image.
such as https://upload.wikimedia.org/wikipedia/commons/9/90/Wikimedia_Hackathon_Amsterdam_2013.svg
I'mg going to use a wordpress plugin called Real-Time Find and Replace
It allows a "Find" and "replace with" with regex
Can we do this with a collection of regexes? :)
Covering all possible input size pixels for historical thumbnails?Code language: plaintext (plaintext)
And once getting it to output the regular expressions in a code block instead of a fancy table, I tested one of them and it seems to be spot on.
--- 250px ---
Find: #(upload\.wikimedia\.org/wikipedia/(?:commons|[a-z]+)/thumb/[^/]+/[^/]+/[^/]+/)(?:12[1-9]|1[3-9][0-9]|2[0-4][0-9])(px-[^"'\s>]+)#
Replace: ${1}250$2
--- FULL SIZE (Greater than 3840px) ---
Find: #(upload\.wikimedia\.org/wikipedia/(?:commons|[a-z]+))/thumb/([^/]+/[^/]+/[^/]+)/(?:384[1-9]|38[5-9][0-9]|39[0-9]{2}|[4-9]\d{3}|\d{5,})px-[^"'\s>]+#
Replace: ${1}/${2}Code language: plaintext (plaintext)
But I then realized that these regexes would actually break the blog post I am writing right now, where I includes a thumbnail URL in text, rather than in an IMG tag?!
So I asked Gemini to get a little more specific, with the following prompt:
I realize that I only want this replacement to happen when the image is actually in img tags? or rather is going to be used as an image in the page, not just the URL used in text (as it is going to be in the article I am currently writing. Can you adjust the rgeexes for that? Code language: plaintext (plaintext)
Which lead to adjusted regexes that seem to work nicely. A sample is below, and you can find the full list at https://phabricator.wikimedia.org/P89869
--- 250px ---
Find: #(\b(?:data-)?src=["'](?:https?:)?//upload\.wikimedia\.org/wikipedia/(?:commons|[a-z]+)/thumb/[^/]+/[^/]+/[^/]+/)(?:12[1-9]|1[3-9][0-9]|2[0-4][0-9])(px-[^"'\s>]+)#
Replace: ${1}250$2
--- FULL SIZE (Greater than 3840px) ---
Find: #(\b(?:data-)?src=["'](?:https?:)?//upload\.wikimedia\.org/wikipedia/(?:commons|[a-z]+))/thumb/([^/]+/[^/]+/[^/]+)/(?:384[1-9]|38[5-9][0-9]|39[0-9]{2}|[4-9]\d{3}|\d{5,})px-[^"'\s>]+#
Replace: ${1}/${2}Code language: plaintext (plaintext)
And then, while trying to enter the various regular expressions into the extension, I ran into an issue…..

So, perhaps I should look at rewriting the actual content with these regular expressions, rather than rewriting them live…..
Or, time to make my own WordPress extension for this simple task.
WordPress plugin
What we are aiming for here can essentially be achieved in just a small number of lines of PHP code. And most of that would be the regex itself…
You can find the plugin code on Github that is written in this section, and I’m currently in the process of putting it on the WordPress plugin “store” for anyone else to use.
add_filter( 'the_content', 'update_wikimedia_thumbnail_sizes', 20 );
function update_wikimedia_thumbnail_sizes( $content ) {
// Skip processing if we are in the WordPress admin dashboard
if ( is_admin() ) {
return $content;
}
$replacements = [
// 20px
'#(\b(?:data-)?src=["\'](?:https?:)?//upload\.wikimedia\.org/wikipedia/(?:commons|[a-z]+)/thumb/[^/]+/[^/]+/[^/]+/)(?:[1-9]|1[0-9])(px-[^"\'\s>]+)#' => '${1}20$2',
// 40px
'#(\b(?:data-)?src=["\'](?:https?:)?//upload\.wikimedia\.org/wikipedia/(?:commons|[a-z]+)/thumb/[^/]+/[^/]+/[^/]+/)(?:2[1-9]|3[0-9])(px-[^"\'\s>]+)#' => '${1}40$2',
// 60px
'#(\b(?:data-)?src=["\'](?:https?:)?//upload\.wikimedia\.org/wikipedia/(?:commons|[a-z]+)/thumb/[^/]+/[^/]+/[^/]+/)(?:4[1-9]|5[0-9])(px-[^"\'\s>]+)#' => '${1}60$2',
// 120px
'#(\b(?:data-)?src=["\'](?:https?:)?//upload\.wikimedia\.org/wikipedia/(?:commons|[a-z]+)/thumb/[^/]+/[^/]+/[^/]+/)(?:6[1-9]|[7-9][0-9]|10[0-9]|11[0-9])(px-[^"\'\s>]+)#' => '${1}120$2',
// 250px
'#(\b(?:data-)?src=["\'](?:https?:)?//upload\.wikimedia\.org/wikipedia/(?:commons|[a-z]+)/thumb/[^/]+/[^/]+/[^/]+/)(?:12[1-9]|1[3-9][0-9]|2[0-4][0-9])(px-[^"\'\s>]+)#' => '${1}250$2',
// 330px
'#(\b(?:data-)?src=["\'](?:https?:)?//upload\.wikimedia\.org/wikipedia/(?:commons|[a-z]+)/thumb/[^/]+/[^/]+/[^/]+/)(?:25[1-9]|2[6-9][0-9]|3[0-2][0-9])(px-[^"\'\s>]+)#' => '${1}330$2',
// 500px
'#(\b(?:data-)?src=["\'](?:https?:)?//upload\.wikimedia\.org/wikipedia/(?:commons|[a-z]+)/thumb/[^/]+/[^/]+/[^/]+/)(?:33[1-9]|3[4-9][0-9]|4[0-9][0-9])(px-[^"\'\s>]+)#' => '${1}500$2',
// 960px
'#(\b(?:data-)?src=["\'](?:https?:)?//upload\.wikimedia\.org/wikipedia/(?:commons|[a-z]+)/thumb/[^/]+/[^/]+/[^/]+/)(?:50[1-9]|5[1-9][0-9]|[6-8][0-9][0-9]|9[0-5][0-9])(px-[^"\'\s>]+)#' => '${1}960$2',
// 1280px
'#(\b(?:data-)?src=["\'](?:https?:)?//upload\.wikimedia\.org/wikipedia/(?:commons|[a-z]+)/thumb/[^/]+/[^/]+/[^/]+/)(?:96[1-9]|9[7-9][0-9]|10[0-9][0-9]|11[0-9][0-9]|12[0-7][0-9])(px-[^"\'\s>]+)#' => '${1}1280$2',
// 1920px
'#(\b(?:data-)?src=["\'](?:https?:)?//upload\.wikimedia\.org/wikipedia/(?:commons|[a-z]+)/thumb/[^/]+/[^/]+/[^/]+/)(?:128[1-9]|129[0-9]|1[3-8][0-9][0-9]|190[0-9]|191[0-9])(px-[^"\'\s>]+)#' => '${1}1920$2',
// 3840px
'#(\b(?:data-)?src=["\'](?:https?:)?//upload\.wikimedia\.org/wikipedia/(?:commons|[a-z]+)/thumb/[^/]+/[^/]+/[^/]+/)(?:192[1-9]|19[3-9][0-9]|2[0-9][0-9][0-9]|3[0-7][0-9][0-9]|38[0-2][0-9]|383[0-9])(px-[^"\'\s>]+)#' => '${1}3840$2',
// FULL SIZE (Greater than 3840px)
'#(\b(?:data-)?src=["\'](?:https?:)?//upload\.wikimedia\.org/wikipedia/(?:commons|[a-z]+))/thumb/([^/]+/[^/]+/[^/]+)/(?:384[1-9]|38[5-9][0-9]|39[0-9]{2}|[4-9]\d{3}|\d{5,})px-[^"\'\s>]+#' => '${1}/${2}'
];
// Run the replacement
return preg_replace( array_keys( $replacements ), array_values( $replacements ), $content );
}Code language: PHP (php)Creating a little framework around such a regex set, and having it be easily selectable by users only too a few minutes.

And the plugin also gives you the flexibility to define your own rules, so I could add my Imgur rewrite too, or implement that as an additional custom set later.
You can also preview changes across all pages, and optionally apply them permanently to the actual content.

Anyway, that closes my morning adventure.