In Drupal 7 user pictures were just attached data to the user object, with lot of custom code to maintain them.
In Drupal 8 they are converted to image fields leveraging the full power of Field and Field UI modules.
Also a new view mode: compact
, was introduced for user accounts which is now being used when there is no need to render the whole user profile, eg in comments.
Converting image picture to a field changed the way it is accessible in the theming layer, now being a regular render array instead of a simple variable:
Drupal 7 picture rendering in node template:
<?php if ($display_submitted): ?>
<div class="meta submitted">
<?php print $user_picture; ?>
<?php print $submitted; ?>
</div>
<?php endif; ?>
Drupal 8:
<?php if ($display_submitted): ?>
<div class="meta submitted">
<?php print render($user_picture); ?>
<?php print $submitted; ?>
</div>
<?php endif; ?>
Also the way the value is retrieved now is changed:
Drupal 7 picture file retrieval:
$uid = 1;
$user = user_load($uid);
$user_picture = is_numeric($user->picture) ? file_load($user->picture) : $user->picture;
Drupal 8:
$uid = 1;
$user = user_load($uid);
if (!empty($user->user_picture)) {
$user_picture = file_load($user->user_picture[LANGUAGE_NOT_SPECIFIED][0]['fid']);
}
Finally, user picture now is not provided by user module but by standard installation profile.
Thus no assumptions should be made and user_picture_enabled() should be used first, or modules should instead just integrate with image fields.