Answers.Body: <p>When you call <code>myGlobalSet.myAssetsField</code>, you're creating an <a href="http://buildwithcraft.com/docs/templating/elementcriteriamodel" rel="nofollow"><strong>ElementCriteriaModel</strong></a>. This is significant, because an ElementCriteriaModel is basically a "search object".</p>
  
  <p>Your <code>design.imgs</code> call produces an ElementCriteriaModel based on <a href="http://buildwithcraft.com/docs/templating/craft.assets" rel="nofollow"><strong><code>craft.assets</code></strong></a>. It will return only the assets which are <a href="http://buildwithcraft.com/docs/relations" rel="nofollow">related to</a> your global field.</p>
  
  <p>You can manipulate your ElementCriteriaModel in whatever way you want!</p>
  
  <pre><code>{% set myAsset = design.imgs.kind('image').sourceId(1).first %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-16T11:53:59.370Z
Answers.Text: Lindsey - I am looking to output the url for the specific image. not sure how to do that with your example above.
Answers.UserDisplayName: user2022284
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-16T16:05:02.993Z
Answers.Text: Quite easily in fact... `myAsset.getUrl()`
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-16T16:35:28.537Z
Answers.Text: @user2022284 - You need some identifiable piece of information about the file you're looking for, like its file name or asset ID, etc. so you can tell Craft what to search for.  Do you know any of those ahead of time?
Answers.UserDisplayName: Brad Bell
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-16T21:49:40.850Z
Answers.Text: Hi Brad : I know the image name and title - both of which will be unique across all the images.
Answers.UserDisplayName: user2022284
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-16T21:57:21.317Z
Answers.Text: @user2022284: If you know the image's name & title, why not just access it directly through `craft.assets`? There's no need to refer to the global field at all if you already know which asset you want.
Answers.UserDisplayName: Lindsey D
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-16T07:33:31.140Z
Answers.LastActivityDate: 2015-08-16T07:33:31.140Z
Answers.UserDisplayName: Lindsey D
Answers.Body: <p>If you have a smallish (under a dozen or so), pre-determined set of distinguished images, then I would create a separate global asset for each of them. So you would have <code>design.logo</code>, <code>design.facebookIcon</code>, etc. And then just refer to them that way:</p>
  
  <pre><code>{% if design.logo|length %}
    {{ design.logo.first.getUrl() }}
  {% endif %}
  </code></pre>
  
  <p>Always check that an asset exists before you use it. Otherwise you will have your site front-end mysteriously crashing at some point in the future when that asset is not there</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-16T21:51:26.833Z
Answers.Text: Hi Marion, Yes, this works for the scenario you describe . Perhaps it easier this way. But will like to still learn how to do so if I were to dump everything in one field - with image name and title being the known element , then search for it.
Answers.UserDisplayName: user2022284
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-08-16T18:31:24.757Z
Answers.LastActivityDate: 2015-08-16T18:31:24.757Z
Answers.UserDisplayName: Marion Newlevant
Body: <p>I am using a global set to store image assets used across the site.  I am not sure how to reference a specific image. I know how to get the image if its just one, using :</p>
  
  <pre><code>{{ design.imgs | length ? design.imgs.first().getUrl() : '' }}
  </code></pre>
  
  <p>What if there are several images and I am looking for a specific one?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-16T02:55:23.057Z
Comments.Text: You could loop through them. But what distinguishes this specific one?
Comments.UserDisplayName: Marion Newlevant
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-16T03:02:44.840Z
Comments.Text: The loop will return all of the images, correct? I am storing a bunch of images in the global and always need to call just one at a time - like the logo.  Each one has a different asset name. ( filename or title )
Comments.UserDisplayName: user2022284
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-16T06:19:29.700Z
Comments.Text: The loop will return all of them, one at a time. If you have a fixed set of specific images (logo, ...), I would make a global asset for each one. So `design.logo` would be your one logo image. If you are trying to do something else, please explain.
Comments.UserDisplayName: Marion Newlevant
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-16T11:40:25.423Z
Comments.Text: Looks like, when using global sets, you can either make a field for every specific item ( like in your example above - design.logo ) or throw all the assets into one field ( imgs in my case).  Looks like your methodology is far simpler.  Is throwing all items into one field and searching for them with the methodology suggested by Lindsey D below unnecessarily complicated ?
Comments.UserDisplayName: user2022284
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-08-16T18:22:48.480Z
Comments.Text: If you know in advance what all the specific items are, and there aren't more than maybe a dozen of them, then I would say my methodology is simpler. But otherwise you may need to go with searching. And you could throw some together in one field, and make specific fileds for some others.
Comments.UserDisplayName: Marion Newlevant
Tags: <templating><assets><image><globals>
Title: Find specific image from global image set?
ThreadText: # Find specific image from global image set?
  
  (Asked by: username_0 on 2015-08-16)
  
  I am using a global set to store image assets used across the site. I am not sure how to reference a specific image. I know how to get the image if its just one, using :
  
  ```
  {{ design.imgs | length ? design.imgs.first().getUrl() : '' }}
  
  ```
  
  What if there are several images and I am looking for a specific one?
  
  **Tags:** templating, assets, image, globals
  
  > **Comments:**
  > **username_1**: You could loop through them. But what distinguishes this specific one?  
  > **username_0**: The loop will return all of the images, correct? I am storing a bunch of images in the global and always need to call just one at a time - like the logo.  Each one has a different asset name. ( filename or title )  
  > **username_1**: The loop will return all of them, one at a time. If you have a fixed set of specific images (logo, ...), I would make a global asset for each one. So `design.logo` would be your one logo image. If you are trying to do something else, please explain.  
  > **username_0**: Looks like, when using global sets, you can either make a field for every specific item ( like in your example above - design.logo ) or throw all the assets into one field ( imgs in my case).  Looks like your methodology is far simpler.  Is throwing all items into one field and searching for them with the methodology suggested by username_2 below unnecessarily complicated ?  
  > **username_1**: If you know in advance what all the specific items are, and there aren't more than maybe a dozen of them, then I would say my methodology is simpler. But otherwise you may need to go with searching. And you could throw some together in one field, and make specific fileds for some others.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2015-08-16. Score: 1
  
  When you call `myGlobalSet.myAssetsField`, you're creating an [**ElementCriteriaModel**](http://buildwithcraft.com/docs/templating/elementcriteriamodel). This is significant, because an ElementCriteriaModel is basically a "search object".
  
  Your `design.imgs` call produces an ElementCriteriaModel based on [**`craft.assets`**](http://buildwithcraft.com/docs/templating/craft.assets). It will return only the assets which are [related to](http://buildwithcraft.com/docs/relations) your global field.
  
  You can manipulate your ElementCriteriaModel in whatever way you want!
  
  ```
  {% set myAsset = design.imgs.kind('image').sourceId(1).first %}
  
  ```
  
  > **Comments:**
  > **username_0**: username_2 - I am looking to output the url for the specific image. not sure how to do that with your example above.  
  > **username_2**: Quite easily in fact... `myAsset.getUrl()`  
  > **username_3**: @username_0 - You need some identifiable piece of information about the file you're looking for, like its file name or asset ID, etc. so you can tell Craft what to search for.  Do you know any of those ahead of time?  
  > **username_0**: Hi username_3 : I know the image name and title - both of which will be unique across all the images.  
  > **username_2**: @username_0: If you know the image's name & title, why not just access it directly through `craft.assets`? There's no need to refer to the global field at all if you already know which asset you want.  
  
  ---
  
  ### Answer by username_1 on 2015-08-16. Score: 1
  
  If you have a smallish (under a dozen or so), pre-determined set of distinguished images, then I would create a separate global asset for each of them. So you would have `design.logo`, `design.facebookIcon`, etc. And then just refer to them that way:
  
  ```
  {% if design.logo|length %}
    {{ design.logo.first.getUrl() }}
  {% endif %}
  
  ```
  
  Always check that an asset exists before you use it. Otherwise you will have your site front-end mysteriously crashing at some point in the future when that asset is not there
  
  > **Comments:**
  > **username_0**: Hi username_1, Yes, this works for the scenario you describe . Perhaps it easier this way. But will like to still learn how to do so if I were to dump everything in one field - with image name and title being the known element , then search for it.  
  
  ---
  
  