use $image->getUrlGenerator()

(cherry picked from commit 66a577dde7a61b3ad2d513591f7b8eadaa369b0c)