Media Library field widget not enforcing image limits

Created on 4 August 2021, over 3 years ago
Updated 17 March 2023, almost 2 years ago

Problem/Motivation

If an image-based media type is configured to have restrictions on the image dimensions, the Media Library form field does not enforce these limits.

Steps to reproduce

  1. Create a new Media Type, with a source of Image
  2. Open the "Manage Fields" page and edit the Image field
  3. Set minimum or maximum image dimensions
  4. Save the field
  5. Edit another entity type's fields
  6. Add a Media field
  7. Include the newly created Media Type as an allowed option
  8. Save the field
  9. Create a new instance of that entity
  10. In the Media Library widget, click the "Add media" button

The bug is now visible. The image upload field doesn't show the restrictions on the dimensions of the image, though it does have the correct file extensions and file size restrictions shown.

Uploading an image that cannot be resized to fit in the required dimensions does not cause an issue. Uploading an image that can be resized does not result in the image being resized.

If going through the Media gallery (/admin/content/media), the image dimension restrictions are correctly enforced.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🐛 Bug report
Status

Active

Version

9.5

Component
Media 

Last updated about 3 hours ago

Created by

🇦🇺Australia simon_tma

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

Merge Requests

Comments & Activities

Not all content is available!

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

Production build 0.71.5 2024