Cedric Knight wrote:
>> Also, it's not really a JPEG but a PNG, and one with a consistent
>> header over the last few weeks:

Bob Proulx wrote:
> I like the idea of tagging mismatched types where the actual content 
> doesn't match the stated type.  That would be a good idea for a
> plugin enhancement.  Perhaps something based upon libmagic?

Internal image type handling is already present in SA, though buried.
See %get_details in ImageInfo.pm.  Not sure the best way to call it, as
such a function is actually internal-only.  Perhaps this:


mimeheader __MIME_GIF    Content-Type =~ /image\/gif/i
mimeheader __MIME_PNG    Content-Type =~ /image\/png/i
mimeheader __MIME_JPEG   Content-Type =~ /image\/jpe?g/i
body __GIF_ATTACH        eval:image_count('gif',1)
body __PNG_ATTACH        eval:image_count('png',1)
body __JPEG_ATTACH       eval:image_count('jpeg',1)

meta IMAGE_MISMATCH      (__MIME_GIF && !__GIF_ATTACH) || (__MIME_PNG &&
!__PNG_ATTACH) || (__MIME_JPEG && !__JPEG_ATTACH)
describe IMAGE_MISMATCH  Contains wrong image format for MIME header
score IMAGE_MISMATCH     1.0


Cedric's MIME_IMAGE_JPG might be interesting too, but I suspect it's too
rare to be useful.

Reply via email to