imageSizeRestrictions works only with readAs as a DataURL
krystofmatejka opened this issue · comments
Hello, imageSizeRestrictions
is taken into account only when readAs
is set as DataURL
. If this is an intention it should be mentioned in documentation or in types. If not then I'm reporting this as a bug.
Hi @kxmatejka
It is intentional, as You can see in the code of the ImageDimensionsValidator it is explicitly checked for readAs
to be DataURL
:
This check is there because if you use other readAs
value than 'DataURL', then the browser built-in Image reader can't correctly load an image, and it throws an error, so we can't extract the image dimensions from it.
If you want this functionality of checking image dimensions with readAs
set to other values, then you need to create a custom validator and probably use some 3rd party package for extracting image dimensions from a buffer or something like that.
Hello, thank you for your response. Fortunately, this is not a problem for me. But it took me some time to figure out what's wrong so I would suggest at least mentioning this in the documentation.
Have a nice day!