datocms / gatsby-source-datocms

Official GatsbyJS source plugin to pull content from DatoCMS
MIT License
140 stars 51 forks source link

Disable `auto=format` for image queries #174

Closed tigrr closed 2 years ago

tigrr commented 2 years ago

I am providing the users with links to download the original image files. But the auto=format imgix param is always being appended in the query string. It seems possible to opt out of this by setting the fm param. But I don't want any conversion happening, just the original file. There must be a way to disable the addition of auto=format to the URL.

matjack1 commented 2 years ago

@tigrr I think you have two options to solve your issue, have a look at this GraphQL call:

query MyQuery {
  allDatoCmsAsset {
    edges {
      node {
        url
        path
        format
      }
    }
  }
}

you can either construct the final URL starting from path, which doesn't have the auto=format or you can append the format that you get from GraphQL as the fm parameter, which should do the job as well.

Hope this solves your issue.