aelvan / Imager-Craft

This plugin has been DEPRECATED. Check out Imager X instead.
MIT License
342 stars 69 forks source link

base64Pixel() conflict with Picturefill.js (IE11) #137

Open croxton opened 6 years ago

croxton commented 6 years ago

The code generated by this causes picturefill.js to crash IE 11 (assuming you are using it to polyfill <picture> in older browsers that don't natively support it):

<img src="{{ craft.imager.base64Pixel(16, 9) }}">

Not really a bug but I thought I'd leave this note here in case anyone else runs into it and save them the hour I spent tracking it down.

aelvan commented 6 years ago

Thanks Mark. Have you tracked down the underlying cause? Is it the fact that it's a base64 encoded svg, or something with the escaping maybe?

croxton commented 6 years ago

As far as I can tell base64 is fine so long as it's a gif, but that code generates an SVG and that's what is causing picturefill to choke. This works fine:

  <img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==">