Do I need to change all the SVG files to PNG before triggering a new deploy of the site?

Hi Prismic people,

regarding the change in Prismic of not supporting SVG files, do I need to replace all the .svg files in the media library before triggering any deploy? All the images that look / broken missing in staging, will they still display?

Thanks,
Juliana

Prismic technically still allows SVG files, but they are served as files rather than images.

Your best bet is to convert to PNG, generally.

Hey Juliana,

The SVG's should be replaced by other image formats in articles that you republish, this would be the easiest way. In articles that aren't updated the images shouldn't break.

There's also the workaround we showed in the blog article that you can implement to remove any query string params that you add in your project from SVG's:

function modifyImageUrl(imageUrl) {
  function includesMatch(lookupValue, urlString) {
    const re = new RegExp(lookupValue, 'i');
    return urlString.match(re) !== null;
  }
  if (includesMatch("images.prismic", imageUrl)) {
	return `${imageUrl}&h=60&dpr=2`;
  }
  return imageUrl;
}
const imageUrl = modifyImageUrl(document.data.imageField.url)

Other wise SVG's will still work as long as you don't add URL string parameters, they'll just be served from our Amazon servers and not through Imgix.

Let me know if you have any further questions about this.

Thanks.

1 Like

This issue has been closed due to inactivity. Flag to reopen.