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

Sven Decabooter sdecabooter at gmail.com
Mon Aug 17 15:16:12 UTC 2009


Or better yet, use the following code, which will also work in case you use
the private file system:
$img_tag = '<img src="' . file_create_url($user->picture) . '" />';


2009/8/17 Seth Freach <sfreach at gmail.com>

>  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/ ]
>
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.drupal.org/pipermail/support/attachments/20090817/66ac0b30/attachment.htm>


More information about the support mailing list