Fix for rasterize method when called via an ajax script or any other
situation where the current page is not the page that the image belongs
to.