Answers.Body: <p>I'm also using ImageOptimize and yes, it does work within Matrix.
  Your image has to have the call to the plugin code as specified in the plugin docs. Additionally, your image calls must match the image size you've setup within the plugin preferences panel. Within Matrix, you are calling the assets Field Type.</p>
  
  <p>Here's a sample:</p>
  
  <pre><code>{% if block.type == "graphicCalloutBlock" %}
          {# Full Width Image #}  
          {% set image = block.graphicCalloutImage.one() %}
              &lt;div class="block"&gt;                               
                   {% if image | length %}
                   &lt;img alt=""
                   src="{{ image.optimizedImages.src() }}"
                   srcset="{{ image.optimizedImages.srcset() }}"
                   sizes="(min-width: 480px) 100vw, (min-width: 880px) 75vw, (min-width: 1024px) 50vw,  800px" 
                       /&gt;                               
                  {% endif %}
              &lt;/div&gt;&lt;!-- end block --&gt;
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-11T16:14:30.347Z
Answers.Text: Well, shoot... I had a typo. I was calling `{{ image.optimizedImages().src() }}` instead of `{{ image.optimizedImages.src() }}`. Thank you for your answer!
Answers.UserDisplayName: minttoothpick
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-12-11T14:20:13.473Z
Answers.LastActivityDate: 2017-12-11T14:20:13.473Z
Answers.UserDisplayName: TRIM
Body: <p>With the <a href="https://github.com/nystudio107/craft3-imageoptimize" rel="nofollow noreferrer">ImageOptimize</a> plugin for Craft 3, you create an OptimizedImages field type and then assign that to the Field Layout of your chosen Asset Volume. As far as I can tell (I'm very new to Craft), this means that it won't work to add an Assets field inside a Matrix because it doesn't have the OptimizedImages field associated with it. (I've tried, and received <code>Calling unknown method: craft\elements\Asset::optimizedImages()</code>)</p>
  
  <p>Is anyone aware of a possible workaround? I'm guessing that something like <a href="https://github.com/benjamminf/craft-neo" rel="nofollow noreferrer">Craft Neo</a>, which allows you use existing fields in a Matrix, would be a solution, but at this early stage, there is no version of the plugin for Craft 3.</p>
  
  <p>Thanks for any insight!</p>
  
Tags: <matrix><plugins><craft3>
Title: Using ImageOptimize plugin with Matrix fields
ThreadText: # Using ImageOptimize plugin with Matrix fields
  
  (Asked by: username_0 on 2017-12-11)
  
  With the [ImageOptimize](https://github.com/nystudio107/craft3-imageoptimize) plugin for Craft 3, you create an OptimizedImages field type and then assign that to the Field Layout of your chosen Asset Volume. As far as I can tell (I'm very new to Craft), this means that it won't work to add an Assets field inside a Matrix because it doesn't have the OptimizedImages field associated with it. (I've tried, and received `Calling unknown method: craft\elements\Asset::optimizedImages()`)
  
  Is anyone aware of a possible workaround? I'm guessing that something like [Craft Neo](https://github.com/benjamminf/craft-neo), which allows you use existing fields in a Matrix, would be a solution, but at this early stage, there is no version of the plugin for Craft 3.
  
  Thanks for any insight!
  
  **Tags:** matrix, plugins, craft3
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-12-11. Score: 3 | Accepted answer
  
  I'm also using ImageOptimize and yes, it does work within Matrix.
  Your image has to have the call to the plugin code as specified in the plugin docs. Additionally, your image calls must match the image size you've setup within the plugin preferences panel. Within Matrix, you are calling the assets Field Type.
  
  Here's a sample:
  
  ```
  {% if block.type == "graphicCalloutBlock" %}
          {# Full Width Image #}  
          {% set image = block.graphicCalloutImage.one() %}
              <div class="block">                               
                   {% if image | length %}
                   <img alt=""
                   src="{{ image.optimizedImages.src() }}"
                   srcset="{{ image.optimizedImages.srcset() }}"
                   sizes="(min-width: 480px) 100vw, (min-width: 880px) 75vw, (min-width: 1024px) 50vw,  800px" 
                       />                               
                  {% endif %}
              </div><!-- end block -->
  {% endif %}
  
  ```
  
  > **Comments:**
  > **username_0**: Well, shoot... I had a typo. I was calling `{{ image.optimizedImages().src() }}` instead of `{{ image.optimizedImages.src() }}`. Thank you for your answer!  
  
  ---
  
  