Answers.Body: <p>I am encountering the same problem, but only with images uploaded via Webform; if I edit the profile, delete the image reference, and re-upload the file, it displays as expected.</p>
  
  <p>The reason is that Webform CiviCRM inserts the image_URL value in the database as the path to the webform upload, e.g. <code>/sites/default/files/webform/NNNN.ext</code>. The CiviCRM handler (CRM/Utils/File.php) expects CiviCRM-style image URLs of the form <code>/civicrm/contact/imagefile?photo=NNNN.ext</code>, and so mangles the path twice, once on reading it and then when it runs getFileURL on it.</p>
  
  <p>Thus, anything dependent on $imageURL will break for images uploaded through Webform or other external mechanisms.</p>
  
  <p>The issue is reported on Webform CiviCRM Integration as <em><a href="https://www.drupal.org/project/webform_civicrm/issues/2927260" rel="nofollow noreferrer">Contact Image Upload field integration not working with 4.7</a></em>, first reported by goron on 29 November 2017, with no activity since. I did not find any corresponding issues filed in JIRA. I am using a hacky workaround but it is specific to our particular environment and installation.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-01T15:33:00.690Z
Answers.Text: [Double-posted](https://civicrm.stackexchange.com/a/22965/75) as an answer must be upvoted or accepted on one or the other before it can be used as a duplicate target.
Answers.UserDisplayName: choster
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-07T17:23:24.007Z
Answers.Text: I disagree that the problem is with the webform-civicrm module. On the site I'm working on I imported a whole load of contacts where the contact image URLs refer to externally hosted image files. In Civi 4.6 this worked well. Now it's broken. That has nothing to do with webform_civicrm and everything to do with poorly thought-through changes in Civi.
Answers.UserDisplayName: Graham
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-28T22:26:55.643Z
Answers.LastActivityDate: 2018-02-28T22:26:55.643Z
Answers.UserDisplayName: choster
Answers.Body: <p>This is still a problem as of CiviCRM v4.7.30.  As it currently stands based on the observed behavior, CiviCRM cannot handle relative-URLs for contact images.  The "image_URL" property of the CiviCRM Contact data structure seems to expect a certain URL base.  It seems that you can't use external or internal-non-CiviCRM urls.</p>
  
  <p>Unless this changes or unless Webforms CiviCRM integration changes its behavior (I don't use the integration so I can't confirm if this has happened), this will probably remain broken.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-01-03T12:27:18.573Z
Answers.Text: As far as I know this got fixed, but I'm back here now looking for clues following an update to 5.8.2, where it all looks messed up again.
Answers.UserDisplayName: Graham
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-06-19T16:44:15.193Z
Answers.LastActivityDate: 2018-06-19T16:55:46.667Z
Answers.LastEditDate: 2018-06-19T16:55:46.667Z
Answers.UserDisplayName: theta-fish
Body: <p>I updated civi to version 4.7.25 (from 4.7.8) and now instead of seeing the contact image there's the text "custom" with a link that I can't open</p>
  
  <p><a href="https://i.sstatic.net/WuEic.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/WuEic.png" alt="enter image description here"></a></p>
  
  <p>It should display the profile image coming from the civi db (civicrm_contact.image_URL)</p>
  
  <p>the "custom" link is <a href="https://[website]/civicrm/file?reset=1&amp;filename=custom&amp;mime-type=image/" rel="nofollow noreferrer">https://[website]/civicrm/file?reset=1&amp;filename=custom&amp;mime-type=image/</a></p>
  
  <p>Any ideas?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-15T19:29:17.850Z
Comments.Text: Are you by any chance uploading the image from a Drupal webform? Because that is broken
Comments.UserDisplayName: Yossi
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-12-18T08:45:44.247Z
Comments.Text: But the problem is with the old images too, so I think is more of a display /permission issue, The images are hosted in an Amazon S3 bucket so the URL is pointing there.
Comments.UserDisplayName: acaselli
Tags: <contact-image>
Title: Contact image not displaying
ThreadText: # Contact image not displaying
  
  (Asked by: username_0 on 2017-12-15)
  
  I updated civi to version 4.7.25 (from 4.7.8) and now instead of seeing the contact image there's the text "custom" with a link that I can't open
  
  [![enter image description here](https://i.sstatic.net/WuEic.png)](https://i.sstatic.net/WuEic.png)
  
  It should display the profile image coming from the civi db (civicrm\_contact.image\_URL)
  
  the "custom" link is <https://[website]/civicrm/file?reset=1&filename=custom&mime-type=image/>
  
  Any ideas?
  
  **Tags:** contact-image
  
  > **Comments:**
  > **username_1**: Are you by any chance uploading the image from a Drupal webform? Because that is broken  
  > **username_0**: But the problem is with the old images too, so I think is more of a display /permission issue, The images are hosted in an Amazon S3 bucket so the URL is pointing there.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2018-02-28. Score: 2
  
  I am encountering the same problem, but only with images uploaded via Webform; if I edit the profile, delete the image reference, and re-upload the file, it displays as expected.
  
  The reason is that Webform CiviCRM inserts the image\_URL value in the database as the path to the webform upload, e.g. `/sites/default/files/webform/NNNN.ext`. The CiviCRM handler (CRM/Utils/File.php) expects CiviCRM-style image URLs of the form `/civicrm/contact/imagefile?photo=NNNN.ext`, and so mangles the path twice, once on reading it and then when it runs getFileURL on it.
  
  Thus, anything dependent on $imageURL will break for images uploaded through Webform or other external mechanisms.
  
  The issue is reported on Webform CiviCRM Integration as *[Contact Image Upload field integration not working with 4.7](https://www.drupal.org/project/webform_civicrm/issues/2927260)*, first reported by goron on 29 November 2017, with no activity since. I did not find any corresponding issues filed in JIRA. I am using a hacky workaround but it is specific to our particular environment and installation.
  
  > **Comments:**
  > **username_2**: [Double-posted](https://civicrm.stackexchange.com/a/22965/75) as an answer must be upvoted or accepted on one or the other before it can be used as a duplicate target.  
  > **username_3**: I disagree that the problem is with the webform-civicrm module. On the site I'm working on I imported a whole load of contacts where the contact image URLs refer to externally hosted image files. In Civi 4.6 this worked well. Now it's broken. That has nothing to do with webform_civicrm and everything to do with poorly thought-through changes in Civi.  
  
  ---
  
  ### Answer by username_4 on 2018-06-19. Score: 1
  
  This is still a problem as of CiviCRM v4.7.30. As it currently stands based on the observed behavior, CiviCRM cannot handle relative-URLs for contact images. The "image\_URL" property of the CiviCRM Contact data structure seems to expect a certain URL base. It seems that you can't use external or internal-non-CiviCRM urls.
  
  Unless this changes or unless Webforms CiviCRM integration changes its behavior (I don't use the integration so I can't confirm if this has happened), this will probably remain broken.
  
  > **Comments:**
  > **username_3**: As far as I know this got fixed, but I'm back here now looking for clues following an update to 5.8.2, where it all looks messed up again.  
  
  ---
  
  