Where is the user's picture stored in Drupal 7?

佐手、 提交于 2019-12-06 00:23:53

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!