Answers.Body: <p>during this process : 
  <code>{% set image = block.image.one() %}</code>
  please make sure the name of handle of image is image. 
  For example in this matrix the type is 'image' but to get image url you should call it. item.imageAssets.one().url
  <a href="https://i.sstatic.net/bew2V.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/bew2V.png" alt="Matrix"></a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-24T07:27:27.390Z
Answers.LastActivityDate: 2020-03-24T07:27:27.390Z
Answers.UserDisplayName: aodihis
Answers.Body: <p>Try checking for |length</p>
  
  <pre><code>         {% if image|length %}
            {{ image.url }}
           {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-23T07:46:35.870Z
Answers.Text: Still. Other parameters of the image are printed like id or title but not the url.
Answers.UserDisplayName: analog junkie
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-22T12:25:38.003Z
Answers.LastActivityDate: 2020-02-22T12:25:38.003Z
Answers.UserDisplayName: CreateSean
Answers.Body: <p>block.image is actually an array (even if only 1 image in it) therefore you need to loop over it so try this...</p>
  
  <pre><code>{% for image in block.image.all() %}{{ image.url }}{% endfor %}
  </code></pre>
  
  <p>If you want to check that there is an image first you can use this..</p>
  
  <pre><code>{% if block.image|length %} ... {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-23T07:58:15.123Z
Answers.Text: Same result. I get an id of the image and the proper title, but it will not print the url.
Answers.UserDisplayName: analog junkie
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-23T09:43:59.370Z
Answers.Text: Why do you need {% if block.type == "image" %} ? Have you defined the block.type as 'image'? try removing it.
Answers.UserDisplayName: Steve
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-22T12:07:02.917Z
Answers.LastActivityDate: 2020-02-22T12:31:13.070Z
Answers.LastEditDate: 2020-02-22T12:31:13.070Z
Answers.UserDisplayName: Steve
Body: <p>First time working with matrix fields. In this case to load images. But somehow I can't manage to fetch the url of the Images. I can get the title and id but not the url. Can someone point me to the mistake am am making? Thanks!</p>
  
  <pre><code>{% set allProjects = craft.entries.section(['sectionHandle']) %} 
  
      {% for projects in allProjects.all() %} 
  
          {% for block in projects.matrixFieldHandle.all() %}
  
             {% if block.type == "image" %}
  
               {% set image = block.image.one() %}
               {% if image %}
                {{ image.url }}
               {% endif %}
  
             {% endif %}
  
         {% endfor %}
  
      {% endfor %}
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-02-22T05:55:46.777Z
Comments.Text: If you view the source on the page, what gets output where you expect the image URL to be?
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-02-23T08:50:40.737Z
Comments.Text: I can print {{ image.id }} ... title, width, height, but if I ask for {{ image.url }} there is nothing printed on screen or in the source. It's empty.
Comments.UserDisplayName: analog junkie
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-02-25T11:46:02.857Z
Comments.Text: I have the exact same problem, when I load an url of a channel asset field.
Comments.UserDisplayName: analog junkie
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-02-25T11:55:37.857Z
Comments.Text: Is it possible that it has to do with the fact, that the site runs on mamp?
Comments.UserDisplayName: analog junkie
Tags: <matrix>
Title: Images of Matrix not loading
ThreadText: # Images of Matrix not loading
  
  (Asked by: username_0 on 2020-02-21)
  
  First time working with matrix fields. In this case to load images. But somehow I can't manage to fetch the url of the Images. I can get the title and id but not the url. Can someone point me to the mistake am am making? Thanks!
  
  ```
  {% set allProjects = craft.entries.section(['sectionHandle']) %} 
  
      {% for projects in allProjects.all() %} 
  
          {% for block in projects.matrixFieldHandle.all() %}
  
             {% if block.type == "image" %}
  
               {% set image = block.image.one() %}
               {% if image %}
                {{ image.url }}
               {% endif %}
  
             {% endif %}
  
         {% endfor %}
  
      {% endfor %}
  
  ```
  
  **Tags:** matrix
  
  > **Comments:**
  > **username_1**: If you view the source on the page, what gets output where you expect the image URL to be?  
  > **username_0**: I can print {{ image.id }} ... title, width, height, but if I ask for {{ image.url }} there is nothing printed on screen or in the source. It's empty.  
  > **username_0**: I have the exact same problem, when I load an url of a channel asset field.  
  > **username_0**: Is it possible that it has to do with the fact, that the site runs on mamp?  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_2 on 2020-03-24. Score: 2
  
  during this process :
  `{% set image = block.image.one() %}`
  please make sure the name of handle of image is image.
  For example in this matrix the type is 'image' but to get image url you should call it. item.imageAssets.one().url
  [![Matrix](https://i.sstatic.net/bew2V.png)](https://i.sstatic.net/bew2V.png)
  
  
  ---
  
  ### Answer by username_3 on 2020-02-22. Score: 1
  
  Try checking for |length
  
  ```
           {% if image|length %}
            {{ image.url }}
           {% endif %}
  
  ```
  
  > **Comments:**
  > **username_0**: Still. Other parameters of the image are printed like id or title but not the url.  
  
  ---
  
  ### Answer by username_4 on 2020-02-22. Score: 1
  
  block.image is actually an array (even if only 1 image in it) therefore you need to loop over it so try this...
  
  ```
  {% for image in block.image.all() %}{{ image.url }}{% endfor %}
  
  ```
  
  If you want to check that there is an image first you can use this..
  
  ```
  {% if block.image|length %} ... {% endif %}
  
  ```
  
  > **Comments:**
  > **username_0**: Same result. I get an id of the image and the proper title, but it will not print the url.  
  > **username_4**: Why do you need {% if block.type == "image" %} ? Have you defined the block.type as 'image'? try removing it.  
  
  ---
  
  