Need to replace the user_picture with my own field_profile_picture(since i've provided a nice crop with imagefield crop).

I've succeeded in getting the file path using template_preprocess_user_picture and the code

 function theme_preprocess_user_picture(&$variables) {        
    $account = user_load($variables['account']->uid);
    if(isset($account->field_profile_picture['und'][0]['uri'])) {
        $variables['user_picture'] = $account->field_profile_picture['und'][0]['uri'];

the user_picture is getting replaced by the file path.... how to render the image???

Anyone Please....


how to render the image???

Sounds like you're probably looking for image_style_url(). Assuming you have an image preset called thumbnail, try something like this:

$picture_style = 'thumbnail';
$picture_uri = $account->field_profile_picture['und'][0]['uri'];
$variables['user_picture'] = image_style_url($picture_style, $picture_uri);
  • Thanks for your guidance.... still all am getting is the path to the file (/sites/default/files/styles/large/public/profile_picture/V/V_0.jpg?itok=5202ueE‌​).... am using imagefield crop for the field_profile_picture and default style is the original image...in tat case what value should i give for $picture_style??? – jack Jul 25 '13 at 12:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.