Skip to content

avoid duplicate data: URIs for html-embed-resources #1

Open
@gimsieke

Description

@gimsieke

Currently, all resources will be individually converted to data: URIs. In one case, a single image of 1.8 MB was referred to 166 times from the HTML file. This led to an out of memory error. Even if it succeeded, it is not advisable to create a 400 MB HTML report.

One solution might be to attach a class to each image that is derived from its @src. Then you can include a CSS chunk with the data: URIs, only a single data: URI per @src, even if the image is referred to repeatedly.

<style type="text/css">
  img.images_myimg_jpg { 
    content: url(data:image/jpeg;base64,4tF6jPwa3fj4E…);
  }
</style>
………
<img class="images_myimg_jpg"/>

This is inspired by http://stackoverflow.com/questions/28832129/replace-image-src-location-using-css#answer-28832261
Apparently, though, Firefox does not support content: for images, only background:.

Image scaling will also be important. We’ll deal with it in another issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions