Single Image Formatter (for multi-value image fields)

Created on 25 January 2011, about 14 years ago
Updated 14 January 2025, 3 months ago

When you have a field designed to accept multiple images (e.g. a photo gallery field) there is no way currently to just display the first image. This would be very useful for teasers.

I wrote my own very simple custom module to achieve this. I'm sorry I don't have time to patch media module, but hopefully this code will help someone dealing with the same problem. (this works for both 'media' and 'image' field types)

✨ Feature request
Status

Closed: won't fix

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States Chris Gillis Los Angeles

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡©πŸ‡°Denmark ressa Copenhagen

    A work around for drupal 11, without adding extra modules such as Display Suite, is using Views:

    1. Hide the image field in the content type display
    2. Add a View with only the image (check the box for "Display all values in the same row", and set display to "1")
    3. Add a Contextual filter using ID (Content ID from URL)
Production build 0.71.5 2024