Problem/Motivation

Drupal 11 is compatible with the AVIF format by default. For this reason, field_image and field_media_image should include avif in their default allowed file extensions.

AVIF (AV1 Image File Format) is a modern image format that offers superior compression compared to JPEG, PNG, and even WebP, while maintaining high visual quality. It is now widely supported across modern browsers (Chrome, Firefox, Safari 16.4+, Edge).

Drupal previously added webp to the default allowed extensions for image fields, recognizing the importance of supporting modern formats out of the box. AVIF represents the next step in that progression.

Currently, the default file_extensions setting for image fields in Drupal core is png gif jpg jpeg webp. Site builders who want to allow AVIF uploads must manually update this setting through the UI or via configuration management, creating unnecessary friction.

This change meets the Drupal core feature request criteria:

  • Usage: AVIF adoption is growing rapidly as the successor to WebP. Any Drupal site focused on performance and modern image delivery — which represents a substantial portion of the installed base — benefits directly from this change. Enabling AVIF by default encourages best practices for web performance (Core Web Vitals, LCP) without requiring site builders to know they need to opt in.
  • Technical debt: The change is minimal — adding a single string token (avif) to a few configuration files and one PHP method. It introduces no new procedures, no additional database queries, and no new abstractions. The cost is negligible compared to the performance benefit it unlocks for end users.

The relevant files are:

  • core/profiles/standard/config/install/field.field.node.article.field_image.yml
  • core/profiles/standard/config/optional/field.field.media.image.field_media_image.yml
  • core/modules/image/src/Plugin/Field/FieldType/ImageItem.php (field type defaults)

Steps to reproduce

  1. Install Drupal with the Standard profile.
  2. Navigate to Admin → Structure → Content types → Article → Manage fields → Image field settings.
  3. Observe that avif is not included in the allowed file extensions.
  4. Attempt to upload an .avif image to an Article node — it will be rejected.

Proposed resolution

Add avif to the default file_extensions value in:

  1. field.field.node.article.field_image.yml
  2. field.field.media.image.field_media_image.yml
  3. The defaultFieldSettings() method in ImageItem.php

Important caveat — server-side processing: Drupal's image toolkit (GD or ImageMagick) may not be able to process AVIF files for image styles on all hosting environments. GD requires PHP 8.1+ compiled with libavif. This means:

  • Allowing the extension enables AVIF uploads and delivery of the original file.
  • Image styles applied to AVIF files may fail silently on servers without AVIF support in the image toolkit.

This should be documented and ideally a follow-up issue should address toolkit capability detection, but it should not block adding the extension to the allowed list, consistent with how webp was handled.

Remaining tasks

  • Confirm current browser support matrix for AVIF is sufficient for inclusion.
  • Verify behavior of GD and ImageMagick toolkits when processing AVIF files in image styles.
  • Write or update tests covering the new default.
  • Determine if a hook_update_N / post-update hook is needed for existing sites (not just new installs).
  • Review whether the demo_umami profile also needs updating.

User interface changes

The default value of the "Allowed file extensions" field in image field settings will include avif for new Drupal installations using the Standard profile. No UI changes to forms or labels.

Introduced terminology

None.

API changes

The return value of ImageItem::defaultFieldSettings() will include avif in the file_extensions string. This is a minor change and only affects new field instances created programmatically without explicitly setting file_extensions.

Data model changes

None. This only affects default configuration values, not the schema.

Release notes snippet

AVIF images can now be uploaded to image fields by default. Site builders no longer need to manually add avif to the allowed file extensions. Note that generating image styles from AVIF files requires PHP 8.1+ with libavif support enabled in the GD toolkit, or a compatible ImageMagick installation.

AI usage (if applicable)

[x] AI Assisted Issue

This issue was generated with AI assistance, but was reviewed and refined by the creator.

CommentFileSizeAuthor
allowed-file-extensions.png29.83 KBcadence96

Issue fork drupal-3581280

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

cadence96 created an issue. See original summary.

adhershmnair made their first commit to this issue’s fork.

adhershmnair’s picture

Status: Active » Needs review
smustgrave’s picture

Status: Needs review » Needs work
Issue tags: +Needs change record

May be overkill but think we should add a CR to announce a new default is being added.