Media type image resolution restrictions are not enforced

Created on 19 September 2023, 9 months ago
Updated 3 October 2023, 9 months ago

Problem/Motivation

When using a Media Type (entity reference) as a Site Setting field, the referenced Media Type Image's minimum and maximum resolution settings are ignored. This allows the uploading of images that are smaller or greater than the resolution settings.

Steps to reproduce

Create a media type that contains an image field.
Set a minimum and/or maximum resolution size on the image field.
Configure a site setting that references the media type created above.
Create the site setting and upload an image that is outside of the minimum/maximum resolution settings you previously configured. It will allow that image to be uploaded.

Proposed resolution

Apply the same restrictions set in the Media Type when creating the Site Setting.

Potential Workaround

Instead of uploading the image via Site Settings, first upload the image under /media/add, then reference that image in the site setting.
This way the restrictions are enforced by Media Module before creating the Site Setting.

πŸ› Bug report
Status

Closed: duplicate

Version

1.20

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada djac

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

Comments & Activities

  • Issue created by @djac
  • πŸ‡¨πŸ‡¦Canada djac
  • Status changed to Postponed: needs info 9 months ago
  • πŸ‡¬πŸ‡§United Kingdom scott_euser

    I don't think we make any modifications to the way the form field widgets work at all. Would it not be the same issue then if you add a media field to eg a Taxonomy Term? Possible an issue for Core if so rather than this module?

  • Status changed to Closed: duplicate 9 months ago
  • πŸ‡¨πŸ‡¦Canada djac

    It seems uploading a tiny image is allowed when using taxonomy that references a media type containing an image field with minimum resolution restrictions. So the taxonomy behavior seems similar to the site settings behavior and the image resolution min/max are not enforced.

    @scott_euser looks like you're right, this is looking like a core/media issue and not due to site_settings.
    Looks like this can be related to https://www.drupal.org/project/drupal/issues/3226629 πŸ› Media Library field widget not enforcing image limits Active

Production build 0.69.0 2024