Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gimsieke opened this issue Jan 10, 2016 · 0 comments
Open

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

gimsieke opened this issue Jan 10, 2016 · 0 comments

Comments

@gimsieke
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant