1

In Craft CMS, I am using the imageoptimize plugin to optimize images. I have added field imageoptimize & in assets created volume added field in field layout but when I am adding entry it showing me the message 'OptimizedImages fields only work when added to an Asset Volume's layout.'.

I am using Craft CMS version 3.024 and ImageOptimize plugin version 1.4.38. Why is the field not showing up?

4
  • "but when i am adding entry" The field is not supposed to work for entries, it will only work for assets – Robin Schambach Sep 17 '18 at 10:42
  • @RobinSchambach In front-end, we have to code for that to make it image optimized? – Pramod Pandey Sep 17 '18 at 11:01
  • For the source sets and sizes yes – Robin Schambach Sep 17 '18 at 11:03
  • @RobinSchambach In front-end i have tried this code :- {% set optimizedImages = entry.myAssetField.one().optimizedImagesField %} <img src="{{ optimizedImages.src() }}" srcset="{{ optimizedImages.srcset() }}" sizes="100vw" /> It is not showing images. – Pramod Pandey Sep 17 '18 at 11:06
2

So a per the documentation, the Optimized Images field should only be added to an Asset Volume's layout. You do not need to, and should not add that field to your Section field layouts.

Please verify for me that after doing so, when you double-click on an Asset, you see a display similar to this:

Screenshot

c.f.: https://github.com/nystudio107/craft-imageoptimize/issues/106

Resolution: This ended up just being some local config issues with Asset Volumes, and then getting rid of pending stuck Queue jobs. After that, away we go!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.