# Getting URL of animated GIF without compression

**URL:** <https://community.prismic.io/t/getting-url-of-animated-gif-without-compression/8534>\
**Category:** Developing with Prismic\
**Created:** [January 6, 2022, 7:23am UTC](https://community.prismic.io/t/getting-url-of-animated-gif-without-compression/8534 "2022-01-06T07:23:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![marco2](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/marco2/32/2734_2.png) [@marco2](https://community.prismic.io/u/marco2)\
**Post date:** [January 6, 2022, 7:23am UTC](https://community.prismic.io/t/getting-url-of-animated-gif-without-compression/8534/1 "2022-01-06T07:23:05Z")

</div>

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

![link](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/a/a6aa052bbd0497a8d7f0c0485386f57bf1c905ea.jpeg)

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.

---

<div class="post-metadata">

**Author:** ![samlittlefair](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/samlittlefair/32/696_2.png) [@samlittlefair](https://community.prismic.io/u/samlittlefair)\
**Post date:** [January 6, 2022, 10:27am UTC](https://community.prismic.io/t/getting-url-of-animated-gif-without-compression/8534/3 "2022-01-06T10:27:51Z")

</div>

Hi @marco2,

You can read FAQs about images, here:

> [@Image Optimization Service FAQ](https://community.prismic.io/t/image-optimization-service-faq/5426#some-images-are-being-too-aggressively-compressed-can-i-turn-off-compression-without-having-to-alter-the-url-rendering-11):
>
> Here are some of the most frequently asked questions about the [Imgix integration](https://prismic.io/docs/core-concepts/image#image-optimization).\* [[Image optimization with imgix: Fast and optimized images | Prismic tutorial] ](https://www.youtube.com/watch?v=48PNQZvs3SM)I use my own CDN, and it doesn't provide dynamic optimization Image Optimization will not work. Since you're putting a CDN in front of our image API we aren't able get the necessary information to recognize the browser requesting the image and won't provide the right image for your browser. On top of that, you will have t…

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

---

<div class="post-metadata">

**Author:** ![marco2](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/marco2/32/2734_2.png) [@marco2](https://community.prismic.io/u/marco2)\
**Post date:** [January 6, 2022, 8:27pm UTC](https://community.prismic.io/t/getting-url-of-animated-gif-without-compression/8534/4 "2022-01-06T20:27:13Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![samlittlefair](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/samlittlefair/32/696_2.png) [@samlittlefair](https://community.prismic.io/u/samlittlefair)\
**Post date:** [January 11, 2022, 6:05pm UTC](https://community.prismic.io/t/getting-url-of-animated-gif-without-compression/8534/6 "2022-01-11T18:05:27Z")

</div>

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
