Refactored main image resize logic into a javascript asset.