2

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

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?

2
  • Are you by any chance uploading the image from a Drupal webform? Because that is broken
    – Yossi
    Commented Dec 15, 2017 at 19:29
  • 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.
    – acaselli
    Commented Dec 18, 2017 at 8:45

2 Answers 2

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, 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.

2
  • Double-posted as an answer must be upvoted or accepted on one or the other before it can be used as a duplicate target.
    – choster
    Commented Mar 1, 2018 at 15:33
  • 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.
    – Graham
    Commented Mar 7, 2018 at 17:23
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.

1
  • 1
    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.
    – Graham
    Commented Jan 3, 2019 at 12:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.