Provide default templateImage width/height if image cannot be loaded, and avoid dividing by 0 when using getWidth/getHeight on an image that is not loaded