[support] How do I load a user's profile image

Seth Freach sfreach at gmail.com
Mon Aug 17 14:02:15 UTC 2009


Alexander,
Picture location is a field in the $user object.  This will probably get 
you what you're looking for:

<?php
global $user;
$img_tag = '<img src="' . base_path() . $user->picture . '" />';
?>

If you need a function to call, you could just wrap the above in a 
function that takes a uid parameter and do a user_load on it instead of 
using the global $user object.

-Seth

Alexander Arul wrote:
> Hi all,
>
> I want to generate the user's picture path using code. I thought there 
> might be an API function like *function user_image_path($uid)*, but 
> nothing like that so far .. please point me in the right direction, 
> thanks :)
>
> Cheers
> Arul*  *
> ------------------------------------------------------------------------
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.drupal.org/pipermail/support/attachments/20090817/73b1ce1a/attachment-0001.htm>


More information about the support mailing list