Steps I've taken to configure Image Optimize

  • Installed plugin, configured binaries (green checkmarks all around)
  • from the CLI, ran ./craft resave/assets - all assets resaved and successful example: - Resaving Female (474749) ... done
  • created new OptimizedImages field "Optimized Images Field (Square)"
  • assigned this field to the Asset Volume Field Layout for our site content
  • from the CLI, ran ./craft resave/assets- all assets from that volume now are unable to be found
    - Resaving Female (474749) ... error: The file "female.jpg" does not exist.

similarly, the CLI command for the plugin to run variants breaks the same way:

running ./craft image-optimize/optimize/create results in:

196/213 - processing asset: Female from field: Optimized Images Field (square)
[error]: The file "female.jpg" does not exist. while processing 196/213 - processing asset: Female from field: Optimized Images Field (square)

We've cleared caches, tried on fresh volumes, etc... same results whenever we add the Optimize Image Field to the volume.

We are still able to create front-end variants in twig, but none using the ImOp field.

Craft CMS 3.4.15 Image Optimize 1.6.12

Any recommendations on where to go from here? Thanks in advance for any help.

  • So I'm unclear if ImageOptimize is affecting anything here; can you uninstall the plugin, and then try running ./craft resave/assets to see if you get the same error? It seems like a particular asset that Craft is having issues with. Apr 22 '20 at 1:53

Worked with @andrew.welch and found that, although our site is using /html for the webroot, there also existed a /web folder. For a reason not yet identified, the plugin brought the /web folder to the surface as it was attempting to look in that folder. I simply deleted the /web folder, and everything works.

The file craftcms/cms/src/console/Request.php sets the path based on what folders it finds on the filesystem, and "web" is before "html" in the array that it checks

    foreach (['web', 'public', 'public_html', 'html'] as $folder) {
        if (is_dir($dir . DIRECTORY_SEPARATOR . $folder)) {
            $dir .= DIRECTORY_SEPARATOR . $folder;

Thank you Andrew!

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.