Image style is not rendering My field_image is not rendering on user-profile.tpl. I have the following code (two different ways to render for testing):

    $image = field_get_items('user', $user, 'field_image');
    $output = field_view_value('user', $user, 'field_image', $image[0], array(
      'type' =&gt; 'image',
      'settings' =&gt; array(
        'image_style' =&gt; 'header_image_160x160',
      ),
    ));
    print render($output);


This produces the following in html:

&lt;img src="https://coinme.io/sites/default/files/styles/header_image_160x160/public?itok=f31sbmSd" width="160" height="160" alt=""&gt;


I get the dead image logo. It is missing the final part of the file structure. And this is how I normally render:

$to_render = field_view_field('user', $user, 'field_image', array('settings' =&gt; array('image_style' =&gt; 'header_image_160x160'))); print render($to_render);


This is showing the default image, even though the image does exist:

https://coinme.io/sites/default/files/styles/header_image_160x160/public/images/profile/profile-large.png?itok=rb-2qFOw

I have the same field in a content type which is rendering correctly (only difference being the $user user -> $node node.

&lt;?php $to_render = field_view_field('node', $node, 'field_image', array('settings' =&gt; array('image_style' =&gt; 'header_image_160x160'))); print render($to_render);?&gt;


So it appears that when using user-profile specifically is the issue. I have also tried adding a new field type and same effect. Any suggestions?

Thanks,
Paul.
The answer was simple, $user is the user logged in. As my logged in user didn't have a profile image, all I kept seeing was the default. Unfortunately, elsewhere on the page I am not using $user but just $field_*, so it looked like I was using the right variable. This fixed it:

&lt;?php $account = $elements['#account'];?&gt;


And then updated $user to $account. 

&lt;?php $to_render = field_view_field('user', $account, 'field_image', array('settings' =&gt; array('image_style' =&gt; 'header_image_160x160'))); print render($to_render);?&gt;  


You cannot believe how much time and searching I did to fix this, and it turned out I was looking at the wrong variable the whole time.

Thank you,
Paul.