Manual:Thumb.php

Details
Script used to resize images if it is configured to be done when the web browser requests the image and not when generating the page. This script can be used as a 404 handler to generate image thumbs when they don't exist.

To use it, set $wgGenerateThumbnailOnParse to false and set a rewrite rule to call this script in a file in $wgUploadPath/thumb/ doesn't exist. If your wiki is in the /wiki directory, something like this should work: