-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(utility/fileupload): file_validate_image_resolution #1342
feat(utility/fileupload): file_validate_image_resolution #1342
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, can simplify a bit with the ??
operator?
Hm, but will this change be enough? Can you add a test case to UploadFileServiceTest? We copied the code from Drupal core FileItem, how does an image file item handle this? I guess it is done in ImageWidget, that's why it is missing. |
Another problem is that you cannot use So probably you will need a copy of file_validate_image_resolution() as method in our file upload service. |
@klausi yes, that is enough, the $validators array is used here |
@klausi I made a copy of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah great, overlooked file_validate().
Yes, please add a test!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, approach makes sense. I see some minor issues and please add a test case for minimum resolution settings as well that you get out an error message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
make it possible to validate the image resolution
file size and file extension validation is already in place