Fixed MIME type truncation on embedded images

Except for png, the data URIs for images were being written like
data:image/mp, data:image/pg, data:image/if instead of bmp, jpg, gif.