How can I show the Users Profile Picture on a Civicrm Form please (in joomla)?

Thanks a lot, Sri

  • Hi Sri welcome to Civicrm Stackexchange what kind of form? Do you mean a contribution page/event page or a "profile" form. – Luke Stewart Dec 17 '18 at 19:21
  • Hi Luke, a profile form or a code snippet that I can use to display the profile picture on a joomla article please. - Sri – sri Dec 18 '18 at 5:15

You can use an API to get the image URL for a contact. For eg -

$result = civicrm_api3('Contact', 'getsingle', [
  'return' => ["image_URL"],
  'id' => contact_id,

And then copy the value returned by the above API and fed it to the source of image tag in simple HTML code:-


  <img src = "$result['image_URL']" />
  • Hi Jitendra. Sorry for the late response. Thanks very much for your help. I will try this! - Sri – sri Feb 13 '19 at 11:02

Just posting so that anyone having a similar question can benefit.

You can login to Civicirm and uder the Support Developer Menu Item look at Developer > API. Here you can generate your API code including any of the feilds you require. Following is the full PHP code I used to call the profile Display Name, Photograph, Job Title & Phone. Perhaps it is not the most optimized code but it works.. The last Print statements needs to be wrapped withing html tags for formatting. 2nd one is the image path so needs to wrapped within in a image tags src (can not post with html tags here)

(PHP starts)
defined('_JEXEC') OR defined('_VALID_MOS') OR die( "Direct Access Is Not Allowed" );
$user = JFactory::getUser();
require_once JPATH_ROOT . '/administrator/components/com_civicrm/helpers/api.php'; 

$email = $user->email;

$details = civicrm_api3('Contact', 'getsingle', [
  'return' => ["display_name", "image_URL", "job_title", "phone"],
  'email' => $email,
$profile = array();
foreach ($details as $key => $value) {
    $profile[$x]= "$value";
if ($profile[2]=="") {
    $profile[2]= "/templates/common/images/member-dash-default-photo.jpg";

print_r( $profile[1])
echo $profile[2]
print_r( $profile[3])
print_r( $profile[7])
print_r( $profile[9])
(PHP ends)

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.