Question

How to integrate new BPG Image format into Wordpress?

  • Posted on December 26, 2014
  • cooler91Asked by cooler91

Latest wordpress, Server Ubuntu 14.10


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

It’s still early days for the BPG format. So there isn’t much out there yet as far as built in support. The libbgp source includes a Javascript library that decodes the images browser side so that the user’s browser doesn’t need to support the format natively. From the project’s README file:

The Javascript decoder substitutes all the <img> tags with a source having a .bpg extension with a <canvas> tag and decodes the BPG image into it. Stylesheets are supported (the ‘id’ and ‘class’ attributes are preserved). The ‘width’ and ‘height’ attributes are supported only with pixel units.

The image data is downloaded with the XMLHttpRequest object. So the BPG images and the BPG Javascript decoder must be in the same domain unless Cross-Origin Resource Sharing is used.

For the most basic support, you’d simply need to include the Javascript in your templates:

<script type="text/javascript" src="bpgdec.js"></script>