Answers.Body: <p>Without more context about what the API call you're making is, I can't say why it just returns a number.  Here's what happens when I call the API from my command line to get the results of the attachment with an ID of 1:</p>
  
  <pre><code>» cv api attachment.get id=1
  {
      "is_error": 0,
      "version": 3,
      "count": 1,
      "id": 1,
      "values": {
          "1": {
              "id": "1",
              "name": "Project_Properties_dmaster_677.png",
              "mime_type": "image/png",
              "description": "",
              "upload_date": "2018-11-27 22:19:47",
              "entity_table": "civicrm_activity",
              "entity_id": "628",
              "icon": "fa-file-image-o",
              "created_id": "",
              "url": "http://dmaster.localhost/civicrm/file?reset=1&amp;id=1&amp;eid=628",
              "path": "/home/jon/local/civicrm-buildkit/build/dmaster/sites/default/files/civicrm/custom//Project_Properties_dmaster_677_ab277eebda5f50aeb9910018ab356f34.png"
          }
      }
  }
  </code></pre>
  
  <p>It returns the URL property which I can output in an HTML file within an <code>&lt;img&gt;</code> tag to display the image on a web page.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-28T22:25:18.310Z
Answers.Text: Sorry for not clarifying in the original post. After more research I realized that the number I was referring to is the file ID number that shows up as a field when getting a contact's info. Thanks for the help.
Answers.UserDisplayName: Blake
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-11-28T04:24:07.887Z
Answers.LastActivityDate: 2018-11-28T04:24:07.887Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>How can I retrieve images uploaded in custom field sets for contacts? Could you get a URL for them the same way you can for the contact "image_url" in the API?</p>
  
  <p>When I look up the custom field for the file in the API, it just returns a number. I looked at the code docs for the Attachment entity in the API, but this seems to be more suited for non-image files, unless I'm mistaken. I am looking to call the API and display these images on a web page.</p>
  
  <p>I'd appreciate any help I can get, thanks.</p>
  
Tags: <custom-fields><api><images>
Title: How to retrieve custom field image files?
ThreadText: # How to retrieve custom field image files?
  
  (Asked by: username_0 on 2018-11-27)
  
  How can I retrieve images uploaded in custom field sets for contacts? Could you get a URL for them the same way you can for the contact "image\_url" in the API?
  
  When I look up the custom field for the file in the API, it just returns a number. I looked at the code docs for the Attachment entity in the API, but this seems to be more suited for non-image files, unless I'm mistaken. I am looking to call the API and display these images on a web page.
  
  I'd appreciate any help I can get, thanks.
  
  **Tags:** custom-fields, api, images
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-11-28. Score: 2 | Accepted answer
  
  Without more context about what the API call you're making is, I can't say why it just returns a number. Here's what happens when I call the API from my command line to get the results of the attachment with an ID of 1:
  
  ```
  » cv api attachment.get id=1
  {
      "is_error": 0,
      "version": 3,
      "count": 1,
      "id": 1,
      "values": {
          "1": {
              "id": "1",
              "name": "Project_Properties_dmaster_677.png",
              "mime_type": "image/png",
              "description": "",
              "upload_date": "2018-11-27 22:19:47",
              "entity_table": "civicrm_activity",
              "entity_id": "628",
              "icon": "fa-file-image-o",
              "created_id": "",
              "url": "http://dmaster.localhost/civicrm/file?reset=1&id=1&eid=628",
              "path": "/home/jon/local/civicrm-buildkit/build/dmaster/sites/default/files/civicrm/custom//Project_Properties_dmaster_677_ab277eebda5f50aeb9910018ab356f34.png"
          }
      }
  }
  
  ```
  
  It returns the URL property which I can output in an HTML file within an `<img>` tag to display the image on a web page.
  
  > **Comments:**
  > **username_0**: Sorry for not clarifying in the original post. After more research I realized that the number I was referring to is the file ID number that shows up as a field when getting a contact's info. Thanks for the help.  
  
  ---
  
  