Do image size calculation in CoffeScript

The 'loading' placeholder for image screwed up the scroll
positioning, due to height being different from the real image
height.