2

I have currently created a custom field in CiviEvents to upload an image for my event. When viewing the eventinfo page I can see the image in a collapsible field which shows the thumbnail of the image and when I click on the image it enlarges in a popup box.

All I need is the actual custom field url that point to the image so I can theme it correctly on my template.

I've dug deep into the CustomDataView.tpl and come across {$element.field_value} but again this loads the custom field in the collapsible pane.

Any suggestions?

Thanks in advance

2

For security reasons, CiviCRM does not expose uploaded files directly, but routes them through a php script which checks permissions before fetching the image. If you know the file id and the event id, then you can construct the url yourself:

yoursite.org?q=civicrm/file&reset=1&id=FILE_ID&eid=EVENT_ID

  • Is there a way to input the FILE_ID and EVENT_ID programically as for each event the uploaded picture would be different? Thanks in advance – pacusi May 28 '16 at 12:18
  • Of course you would need to use variables. – Coleman May 28 '16 at 13:15
  • This is not right anymore, since a file hash is mandatory. See civicrm.stackexchange.com/questions/28754/… – Philipp Michael Jul 18 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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