nystudio107/craft-imageoptimize

Allow 0 variants on OptimizedImages field

acalvino4 opened this issue · 2 comments

Is your feature request related to a problem? Please describe.

Currently, when configuring the field settings for an OptimizedImages field, I cannot remove all the variants. This is desired bc sometimes I want to us this plugin just for generating placeholder images, lightness value, color palette, etc.

Describe the solution you would like

Ideally I would requirement to have at least one image variant lifted.

Describe alternatives you have considered

I could just leave a single variant option in place; however, that clutters the asset view, and wastes processing time when not needed.

I read your writeup here, and your request makes more sense in context:

https://github.com/acalvino4/craft-easy-image/blob/master/docs/usage-comparison-other-plugins.md#imageoptimize

I wanted to point out some things that aren't quite right tho:

Doesn't support generating avif (better compression than webp, and no 'color banding')

Actually, you can add any variant creators you want in the config, and it will work:

https://github.com/nystudio107/craft-imageoptimize/blob/develop/src/config.php#L223 & https://github.com/nystudio107/craft-imageoptimize/blob/develop/src/config.php#L163

You're on your own for generating complex picture markup mentioned before

Not true, there are methods on the model for both"
<img> tags: https://github.com/nystudio107/craft-imageoptimize/blob/develop/src/models/OptimizedImage.php#L416

<picture> tags: https://github.com/nystudio107/craft-imageoptimize/blob/develop/src/models/OptimizedImage.php#L452

Also ImageOptimize lets you create transform sets via Twig if you want as well.

Thanks for the feedback. I've updated my docs to reflect that. Feel free to open an issue on my repo if you have any other feedback (docs or otherwise)!

Fwiw, I did search your docs extensively and test out your plugin quite a bit before writing mine and did not come across those options, so you may want to update the docs to make that info easier to find for anyone looking for the same things.