Guide: Files, Images, And Media

Drupal has several ways to handle images and media.

An image field references an image file. Media is more complex and can be reused across content.

Image

Image file field.

Configure image styles for display.

Images can be embedded in CKEditor.

File

Files can be attached to content and stored in a directory on the server.

View uploaded files: Content > Files.

File System Settings

Configuration > Media > File system

Most settings are configured in settings.php and are read only here.

Image Field

The Article content type has an image field by default. You can display this above or below the body in Manage Display.

Images uploaded to an image field can be found in Content > Files.

Editor Plugin

You can add images within your content with the CKEditor plugin.

Change image editor button settings here.

Captions

The editor lets you add a caption to both images and media.

Image Styles

We usually need to optimize images for use on the web to reduce the file size and fit the screen. Image styles define dimensions and how displayed images are created from the source.

Go to Configuration > Media > Image styles.

Responsive Images

Core module for rendering responsive images, using image styles at defined breakpoints.

Media

Media is a fieldable entity, which means you can have media types with specific fields you need.

Media can be embedded, add the Media Library button to CKEditor.

Media Library

The Media Library is at Content > Media > Media library.

Standalone Media URL

Enable a route to view media at /media/ID.

There is no way to make this visible only to admins, if you need to do that, set up a view instead.

Remote Video

This media type uses oembed to convert YouTube and Vimeo urls to embedded videos.

Use oEmbed Providers module to add additional providers.

This change record has details on how oembed works in Drupal.

Issues with embedded aspect ratio and responsiveness.

Upload

Bulk Import

Cropping

Replace Files

Delete Files

Orphaned Files

https://www.drupal.org/project/orphaned_files

File Management

Issues

https://www.drupal.org/project/drupal/issues/2821423

 

Tags