nuxt-modules / og-image

Generate OG Images with Vue templates in Nuxt.
https://nuxtseo.com/og-image
360 stars 23 forks source link

fix: images broken for non-jpeg, extension-less paths #201

Closed maximepvrt closed 1 month ago

maximepvrt commented 2 months ago

Currently toBase64Imagefunction use file extension to define MIME Type and the default is jpeg.

https://avatars.githubusercontent.com/maximepvrt => it's a jpeg image => OK https://avatars.githubusercontent.com/shinGangan => it's a png image => KO

I use this code https://stackoverflow.com/questions/57976898/how-to-get-mime-type-from-base-64-string and I defined image/svg+xml as the default value because a svg file that can start with a multitude of things (<svg, <?xml, a comment, …)

Fix #194, certainly #197

maximepvrt commented 2 months ago

@harlan-zw 🙋

harlan-zw commented 1 month ago

Thanks! I've merged in on https://github.com/nuxt-modules/og-image/pull/202 as I couldn't modify your branch.