Manual:$wgUploadStashScalerBaseUrl

Details
To enable remote on-demand scaling, set this to the thumbnail base URL. Full thumbnail URL will be like   where 'e6' are the first two characters of the MD5 hash of the file name. If this is set to false, thumbs are rendered locally as needed.