Getting URL of animated GIF without compression

I'm using the Link object type to send my users directly to JPGs, PDFs, external websites, and animated GIFs.

link

When the user clicks on the button, I open the URL in a new window with:
window.open(data.media_link.url, "_new");

This works great with most media types, but it's not linking to the animated GIFs because it appends "myImage.gif?auto=compress,format" to the end of the URL, and this compresses the file, removing all animation.

How do I turn off this undesired compression so I get the raw URL to the uncompressed GIF? I'd rather not make manual JavaScript modifications to the URL string because it should also support any external website URL, and I don't know what those addresses will end up looking like.

Hi @marco2,

You can read FAQs about images, here:

The URL parameters are Imgix formatting option. I would recommend performing an operation on the URL string if the link type is media, and remove those parameters with string manipulation.

Sam

So the only way to do it is with a string replace String.replace('.gif?auto=compress,format', '.gif')?

Can't I add something to my request to Prismic API to stop appending these parameters?

Hey @marco2,

So the only way to do it is with a string replace String.replace('.gif?auto=compress,format', '.gif') ?

Yes, that's correct.

Can't I add something to my request to Prismic API to stop appending these parameters?

We've looked into this, and last year we started testing a solution, but we encountered issues. For now, that solution is on hold without no timeline to proceed. However, if you want, you could post this as a feature request in the features category to show your support and invite others to do the same.

Sam