Manual:$wgThumbnailScriptPath

Details
Give a path here to use thumb.php for thumbnail generation on client request, instead of generating them on render and outputting a static URL. This is necessary if some of your apache servers don't have read/write access to the thumbnail path.

If you want to use this feature, you would set this as follows: $wgThumbnailScriptPath = "{$wgScriptPath}/thumb.php";