imgix / js-core

A JavaScript client library for generating image URLs with imgix
https://www.imgix.com
BSD 2-Clause "Simplified" License
122 stars 21 forks source link

Allow configure srcSet DPR generation #304

Closed sylcastaing closed 2 years ago

sylcastaing commented 2 years ago

Hello team,

My company and I want to cap DPR src-set generated by buildSrcSet function. We just need 1x and 2x to reduce DOM size and dowloaded image on mobile.

I think we can have an option maxDPR to cap srcet generation.

Example :

{
  maxDPR: 2
}

Or maybe make targetRatios configurable with option inside the _buildDPRSrcSet fonction.

Example :

{
  targetRatios: [1, 2]
}
frederickfogerty commented 2 years ago

Hi @sylcastaing, thanks for the issue! We are currently on a company holiday, so I will aim to get back to you in about two weeks.

frederickfogerty commented 2 years ago

Hey @sylcastaing, we are happy to support a targetDPRRatios type feature. Unfortunately we don't have time to implement this soon, so we will put this in our backlog and prioritise it. We will of course also happily accept a PR for this feature!

sherwinski commented 2 years ago

Resolved as part of #307