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

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

<pre><code>    foreach (['web', 'public', 'public_html', 'html'] as $folder) {
        if (is_dir($dir . DIRECTORY_SEPARATOR . $folder)) {
            $dir .= DIRECTORY_SEPARATOR . $folder;
            break;
        }
    }
</code></pre>

<p>Thank you Andrew!</p>

CC BY-SA 4.0
2020-04-22T23:00:19.707Z
2020-04-22T23:00:19.707Z
Mark Middleton
<p>Steps I've taken to configure Image Optimize</p>

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

<p>similarly, the CLI command for the plugin to run variants breaks the same way:</p>

<p>running <code>./craft image-optimize/optimize/create</code> results in:</p>

<pre><code>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)
</code></pre>

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

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

<blockquote>
  <p>Craft CMS 3.4.15 
  Image Optimize 1.6.12</p>
</blockquote>

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

CC BY-SA 4.0
2020-04-22T01:53:31.490Z
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.
andrew.welch
<plugin-imageoptimize>
Image Optimize Field - adding ImOp field to a volume causes images in that volume to not be found
# Image Optimize Field - adding ImOp field to a volume causes images in that volume to not be found

(Asked by: username_0 on 2020-04-10)

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.

**Tags:** plugin-imageoptimize

> **Comments:**
> **username_1**: 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.  

---

## 1 answers

### Answer by username_0 on 2020-04-22. Score: 1 | Accepted answer

Worked with @username_1 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;
            break;
        }
    }

Thank you Andrew!


---

