Javascript class used to resize image to fit cropper