More robust image file validation

Previously, it was possible to upload PSD files by simply renaming them to have a '.jpg' extension.

This causes issues as wagtailimages cannot resize PSD files causing crashes.

This commit fixes this by validating that the internal format of the file matches the extension.