I'm using a SelectQuery object to retrieve and display a list of users, but I don't know where to get the user's picture from.
The users table has a column called picture, but the data in there is just an integer. Is the picture stored in a blob field somewhere or is there a link to the picture in another table?
The image file itself is stored (usually) somewhere in /sites/default/files
. The reference to that image is stored in the file_managed
table, the picture
column in the users
table contains the fid
(file id) of the picture.
You can load the file object like this:
$file = file_load($fid);
And get the output for the image like this:
$image = theme('image', array('path' => $file->uri, 'alt' => 'Alt text'));
Hello please user this code :
<?php
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$uid = 99;
$account = user_load($uid);
// get image information
$image_path = 'public://avatars/upload/b8f1e69e83aa12cdd3d2babfbcd1fe27_4.gif';
$image_info = image_get_info($image_path);
?>
For get user avatar uri;
Thanks,
JAY