Optimise image delivery.

Hi J,

Been driving me nuts for months looking at the code and thinking there should be a better way.  So, here it is.

Cheers,

Gareth