Problem/Motivation
The matcher has options to display image size and a thumbnail, there are two problems with that. It calls isValid() on every file, even if those options are not enabled and even if they are not images.
For example, that might result in calling isValid() on videos stored on S3, or PDF's or so, resulting in errors/warnings and slow responses.
Proposed resolution
Make two changes:
a) Only call isValid() and do the image factory thing if either of the two options is really enabled.
b) And also only call it if the file extension is supported by the configured toolkit (\Drupal\Core\ImageToolkit\ImageToolkitInterface::getSupportedExtensions(), check how \Drupal\image\Plugin\Field\FieldWidget\ImageWidget::formElement() does that.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comment | File | Size | Author |
---|---|---|---|
#2 | 3018705-2.patch | 2.32 KB | arpad.rozsa |
Comments
Comment #2
arpad.rozsa CreditAttribution: arpad.rozsa at MD Systems GmbH commentedDone the two changes as you suggested.
Comment #3
BerdirLooks good, hard to test without having unit tests and mocking for it.
Comment #5
anonWorks perfect. Thanks for patch.