I'm looking to understand how civicrm manages files/images. After upgrading to 4.5 image handling changed, then 4.6 it seemed to change again. Many people are focused on contact images, however I'm more focused on event images. The latter makes a site much richer.

In the "old" days, a file would be placed in the custom/upload folder and a URL would access it (e.g. civicrm/file/custom/image.jpg. Then civicrm started handling images/files internally and the url resolves the storage location.

I have seen literally dozens of issues/questions on this topic. I'm looking for any "official" documentation for file and image handling. There are many moving parts including the civicrm file/image handler and .htaccess rules. It's been really tricky (for me) to figure out.

Joe Murray, documented here CRM_Utils_System::url: https://issues.civicrm.org/jira/browse/CRM-14499

For images, CRM_Utils_System::url('civicrm/file/imagefile','id={fileID}&eid={entity_id}', TRUE,FALSE,FALSE,TRUE) will provide the image url for front end use. Remove 'imagefile' for other files.

For reference there is some discussion here: http://forum.civicrm.org/index.php/topic,34929.0.html and https://issues.civicrm.org/jira/browse/CRM-16009

and lot's in jira: https://issues.civicrm.org/jira/issues/?jql=text%20~%20%22image%20url%22

  • We're on 4.4.13, and when we upgraded from 4.4.4 to 4.4.6 we put in place a custom PHP change to revert to the 'old' way of generating the URL because the images were coming back corrupted from civicrm/contact/imagefile. We've still got that in place, I probably ought to test it again.
    – DaveFF
    May 22, 2015 at 8:06


Your Answer

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

Browse other questions tagged or ask your own question.