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* *
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/ ]
Thanks Seth, I'll try this tomorrow and let you know if it works.
Cheers Alex
On Mon, Aug 17, 2009 at 10:02 PM, Seth Freach sfreach@gmail.com wrote:
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/ ]
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@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/ ]