refactored out the resize_image - DRY