Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Media Thumbnails

Security covered Under active development 6,673 sites

This module allows for the creation of custom thumbnails for media entities. It provides a plugin system that enables developers to generate preview images for unsupported file types, create different thumbnail variants, or use custom generic thumbnails.

Media Thumbnails

Introduction

Provides a plugin type for custom media entity thumbnails.

This module allows developers to create custom media entity thumbnails using plugins.

That way you can add the media entity 'thumbnail' field to Views or Media entity display modes, optionally add an image style and get preview images e.g. for file types not supported by core thumbnails.

Sample use cases:

  • provide thumbnails for file types unsupported by core, like PDF, SVG, ePub, Word or Excel
  • create variants of thumbnails, e.g. watermarked thumbnails for media entities
  • provide custom generic thumbnails, e.g. configurable in the UI
  • store thumbnails in a custom location, e.g. use public thumbnails for private media entities

Installation

Install this module as usual, and enable at least one thumbnail plugin module. See below for a list of currently existing plugins.

Removal

Uninstall all thumbnail plugin modules. Optionally run the refresh batch operation (see below) to restore the default media thumbnails. At last, uninstall this module.

Configuration

The configuration page (/admin/config/media/thumbnails) allows
specifying a maximum thumbnail width and an optional background color
for plugins supporting it.
There's also a form for running a batch operation for thumbnail regeneration.
Custom plugins might provide their own configuration pages.

API

Plugins can be configured (with annotations) per media file mime type.

Example:

* @MediaThumbnail(
*   id = "media_thumbnail_pdf",
*   label = @Translation("Media Thumbnail PDF"),
*   mime = {
*     "application/pdf"
*   }
* )

The plugin should implement a method createThumbnail($sourceUri).
The uri of the local file (media source) is passed to this method.
The plugin should return a (new or existent) managed thumbnail file object.

All media entity related stuff will be handled by the plugin manager.

Example

The Media Thumbnails PDF module contains
a ready to use plugin. It provides thumbnails for media entities of
mime type application/pdf.

Modules providing thumbnail plugins

Media Thumbnails EPUB
Media Thumbnails Jp2, thanks to Natkeeran
Media Thumbnails PDF
Media Thumbnails SVG
Media Thumbnails Tiff, thanks to Natkeeran
Media Thumbnails Video, thanks to Szczepan Musial

Drupal 8–11

Ask your assistant about Media Thumbnails

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

  • media Drupal core

Required by

7 tracked projects depend on this one

Activity

Tracked releases
3
Tracked since
Sep 2023
Latest release
2 years ago
Releases (12 mo)
0
Maintenance
Slowing

Release Timeline

Releases

Version Type Core PHP Release date
2.0.0 Stable 8–11 Sep 26, 2024
8.x-1.0-beta3 Pre-release 8–11 Sep 16, 2024
8.x-1.0-beta2 Pre-release 8–10 Sep 14, 2023