Problem/Motivation

file_validate_image_resolution() is a validation hook. Most validation hooks check a value and return an error. However, file_validate_image_resolution() does much more.

It:

  1. scales and image within the min/max dimensions
  2. saves the image
  3. displays status messages to the user

I believe this logic is in the wrong place for an API.

We should:

  • deprecate file_validate_image_resolution()
  • create a ImageResizer service that performs the logic or checking dimensions and resizing
  • Move setting messages to calling code, e.g. in upload form validators.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3363745

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

kim.pepper created an issue. See original summary.

kim.pepper’s picture

Issue summary: View changes

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

elber’s picture

Status: Active » Needs work

Hi I just started working in this issue.

Is missing a lot of things

I will keeping working if anyone can help be welcome

elber’s picture

markdorison’s picture

The change record for this issue has been published. It should still be a draft at this point, right?

kim.pepper’s picture

@elber FYI change records should only be published when the issue is committed. Unpublished.

elber’s picture

ok I'm sorry should I exclude it now?

kim.pepper’s picture

Status: Needs work » Postponed

I'm going to postpone this issue on #3221793: Move file upload validation from file.module to constraint validators as we need feedback on the approach before moving any further with this issue.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.