How to integrate new BPG Image format into Wordpress?

December 26, 2014 2.6k views

Latest wordpress, Server Ubuntu 14.10

1 Answer

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>
Have another answer? Share your knowledge.

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