I have multifield image field, Under 'Full Content' view mode, I'd like to display all the images, but How DO I display only one image under 'Teaser' mode?.

I have read post, but i cannot implement it in my pixture_reloaded themes.

Thanks in advance


Jeff Burnz’s picture

The code in the stack overflow article is fine, it does the job and you can use this in PR, add this to template.php and clear the cache:

 * Override or insert variables for theme_field().
function pixture_reloaded_process_field(&$vars) {
  $element = $vars['element'];
  // Field type image
  if ($element['#field_type'] == 'image') {
    // Reduce number of images in teaser view mode to single image
    if ($element['#view_mode'] == 'teaser') {
      $item = reset($vars['items']);
      $vars['items'] = array($item);
Mark Vincent Verallo’s picture

Another way is to use the Field multiple limit module.

kopeboy’s picture

Much appreciated! ;) Thank you.

Stone Liu’s picture

Issue summary: View changes

Field multiple limit is the solution to my case too, thanks for the info.
I use CKeditor the image button to add images to nodes and it worked fine on local machine. But when go on server all images added this way via CKeditor are dead. Tried pathologic to no avail. As a result have to get other way around.
Finally I upload multiple images through image field and use the module mentioned above to display only one image on teaser. Job done.
Just can't get the CKeditor to show images correctly after days of searching and investigating, so frustrated...

Jeff Burnz’s picture

Status: Active » Fixed

This is a setting in Adaptivetheme, so in Pixture Reloaded theme settings you can just select it in the extensions > image settings, no need for a module. Job done.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

hitech3273’s picture

#2 thank it works for me in Drupal 7.52

AmazingFork’s picture

In Drupal 8, you can go to views, frontpage (example), and edit. Format = Grid & Show Fields, then under fields add image and title. Click on image, it pops up a window, look for "Multiple field settings", change value to 1. Save everything. This will set your content to show on the front page, in a grid, with a title and only 1 image, instead of displaying say 10 images all at once. This can be modified in a variety of ways but the general concept is there.