Skip to content
EPUBCheck · Images, audio and media overlays

EPUBCheck MED_007: picture source without type

Updated:

EPUBCheck MED_007 is an error message: “Picture "source" elements must define a "type" attribute when they reference foreign resources; found resource "…" of type "…".” A source element inside picture references a foreign resource without a type attribute. A reading app uses the type to skip formats it cannot show, so a non-core image format must say what it is; EPUBCheck names the file and its type.

The official message

Picture "source" elements must define a "type" attribute when they reference foreign resources; found resource "%1$s" of type "%2$s".

Default severity
Error. The EPUB breaks a rule of the specification and is invalid. Stores and Send to Kindle may reject it, and EPUBCheck exits with status 1.
EPUBCheck version
5.4.0

EPUBCheck prints this ID with an underscore instead of a hyphen; this page uses the ID exactly as EPUBCheck reports it.

%1$s, %2$s… are filled in with the file, value or element EPUBCheck found.

Typical causes

  • A picture element written for the web, where source elements often omit type.
  • AVIF, JPEG XL or other newer formats offered without a type attribute.

How to fix it

  1. Add the media type to the source element, for example <source srcset="fig1.avif" type="image/avif"/>.
  2. Keep a core format (JPEG, PNG, GIF, WebP or SVG) in the img element of the same picture as the fallback.
  3. Rebuild the EPUB and run EPUBCheck again to confirm the message is gone.

When it's not this

If the img itself uses a non-core format, the error is MED-003.

Terms used here

Other MED messages

  • MED-008 The time specified in the clipBegin attribute must not be after clipEnd.
  • MED-005 Media Overlay audio reference … to non-standard audio type … found.
  • MED-009 The time specified in the clipBegin attribute must not be the same as clipEnd.
  • MED-004 Image file header may be corrupted.
  • MED_010 EPUB Content Documents referenced from a Media Overlay must specify the "media-overlay" attribute.
  • MED-003 Picture "img" elements must reference core media type resources, but found resource "…" of type "…".

Sources

Message text and severity from EPUBCheck 5.4.0 (W3C, BSD-3-Clause). Explanation by EpubCC.

FAQ

What does EPUBCheck MED_007 mean?

EPUBCheck MED_007 is an error message: “Picture "source" elements must define a "type" attribute when they reference foreign resources; found resource "…" of type "…".” A source element inside picture references a foreign resource without a type attribute. A reading app uses the type to skip formats it cannot show, so a non-core image format must say what it is; EPUBCheck names the file and its type.

Is MED_007 an error?

MED_007 is reported as error by default. The EPUB breaks a rule of the specification and is invalid. Stores and Send to Kindle may reject it, and EPUBCheck exits with status 1.