Problem/Motivation
Minimum image resolution is currently not supported for Media Bulk Upload.
There is #3081948: Support for maximum allowed image size, which tries to implement maximum and minimum image resolution validation. But this is not using Dropzone functionalilty as far as I can see, but applying validation after the files have been uploaded.
I would prefer to have this handled via Dropzone, so files are rejected by Dropzone right away. Example: https://gitlab.com/meno/dropzone/-/wikis/FAQ#reject-images-based-on-imag...
Steps to reproduce
- Configure minimum image resolution for an image media type target field
- Configure bulk upload for this media type
- Bulk Upload an image with dimensions smaller than the minimum image resolution
- The image can be uploaded (while it is expected that it will not allow uploading)
Proposed resolution
Use https://gitlab.com/meno/dropzone/-/wikis/FAQ#reject-images-based-on-imag... and patch from here https://www.drupal.org/project/dropzonejs/issues/2927754#comment-13796310 and integrate this in Media Bulk Upload.
In cases where there are non-image media types and image media types mixed, the minimum image resolution validation will be skipped (user will be warned).
In cases where there are multiple image media types with different mininum image resolutions only on minimum image resolution will be validated (and user will be warned about that).
Maybe #3081948: Support for maximum allowed image size can be used for these two cases where the Dropzone validation is not working fully.
Remaining tasks
Create a patch
User interface changes
Warnings will appear in the form for mixed media type combinations that do not support minimum image resolutions and for multiple image media types that only support one minimum image resolution.
API changes
None
Data model changes
None
Comments
Comment #2
stefan.kornThis patch should make it work
You will need to first apply this patch to DropzoneJS: https://www.drupal.org/files/issues/2020-08-21/validate_images_based_on_...
Comment #3
stefan.kornComment #4
stefan.kornrerolled for 3.x
not sure if there should be some modifications due to dropzonejs integration now being a submodule of media_bulk_upload. It works as before if the dropzone integration is enabled. I have not tested without dropzone integration, whether there are problems and whether the minimal dimension validation is provided by the managed file element by itself.
Comment #5
kristen polChanging version.
Comment #6
jannakha commentedthank you for your contribution!
please provide merge request for easier/faster testing/reviewing process.