Patch for image checks it really is an image

Patch for image checks it really is an image