Move image path manipulation to server side

This pull request does the manipulation of image file paths on the server side.  The code ends up being cleaner, and will provide better support for retrying Cloud Files uploads and downloads if we choose to do so.