Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow 0 variants on OptimizedImages field #389

Open
acalvino4 opened this issue Aug 2, 2023 · 2 comments
Open

Allow 0 variants on OptimizedImages field #389

acalvino4 opened this issue Aug 2, 2023 · 2 comments

Comments

@acalvino4
Copy link

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.

@khalwat
Copy link
Contributor

khalwat commented Aug 9, 2023

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.

@acalvino4
Copy link
Author

acalvino4 commented Aug 9, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants