The serving of static image files by
ms-files.php can be problematic with some server setups, especially those that are using nginx to serve static files. I wrote the following to deal with uploaded files in situations where I don’t care about masking the actual location of the images.
For WordPress 3.1+:
For WordPress 3.0: