glide icon indicating copy to clipboard operation
glide copied to clipboard

RFC - Throw an exception if an invalid value format is provided instead of silently converting it to `jpg`.

Open ADmad opened this issue 1 year ago • 3 comments

Currently any invalid value for fm gets silently coerced to jpg by the encoder. This behavior, while ensure an image is always generated, has couple of issues.

  • A dev error like a typo in the format name would be difficult to track down since the lib gives no error about it.
  • Since all parameter values are used to generate the hash key using multiple invalid value for fm would generate multiple cached images which would be actually the same.

Based on the community feedback I would like to throw an exception instead for an invalid format value.

Tagging in recent contributors to the 3.x branch @deluxetom @Art4 @nlemoine @konnng-dev

ADmad avatar Dec 19 '24 13:12 ADmad

What about throwing an exception and adding an option for a default format on invalid fm.

Art4 avatar Dec 19 '24 14:12 Art4

@Art4 I like that idea, it would need to be defined as a preset, right?

deluxetom avatar Dec 19 '24 18:12 deluxetom

What about throwing an exception and adding an option for a default format on invalid fm.

So if the default format option is set that would be used instead throwing an exception in case of an invalid fm? I too like the idea.

ADmad avatar Dec 20 '24 04:12 ADmad