WICKET-5602 DynamicImageResource should set the mime type after reading the image data

(cherry picked from commit d0fd2102967f34e35be1d009085c314898b8fb0a)