- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
ImageField: bug with Symfony Image constraint #5227
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
Comments
Well explained! Based on this, I think this issue has 2 sub-issues:
|
Hi, Versions: CrudController
src/Validator/Constraint/EasyAdminFile.php
src/Validator/Constraint/EasyAdminFileValidator.php
|
I still think it should work out-of-the-box in EA, but your workaround is valid, thanks for sharing it! |
@javiereguiluz It will be great to add the validation of Image with ImageField :) |
@Digi92 thanks for your implementation. I am getting following error message on using it, do you have any idea what is wrong? |
In fact currently it sends two values including the file name first then the file second, just ignore the validation if it is not an instance of FileUploaded: src/Validator/EasyadminImage.php :
src/Validator/EasyadminImageValidator.php :
usage example :
|
I came to the same conclusion @abouross. |
Just to say thanks to @Digi92 . Working solution on Symfony 5.4.22 and Easyadmin 4.6.1. |
@javiereguiluz do you have any ideas on how this one could be fixed so we do not need a workaround? I plan to try and solve this issue, so looking for some feedback if there's one before I dive into this. |
This is because the same constraints are passed to the In order to properly fix this issue, we should create a new custom option, for instance |
I just created a PR to fix this issue: #6258 If you can, please try it! |
Describe the bug
Hi, I'm using EasyAdmin on a side project, and I decided to use an ImageField on a form to upload... well, an image. That being done, I tried to use it and it was working just fine, until I tried to put a constraint on the ImageField in the CrudController. Once you put on constraint on it, to prevent users to from uploading other types of files, you get the error 'The file could not be found.'. It is even impossible to create the entity.
To Reproduce
(OPTIONAL) Additional context
This is what I've done:
I think using the ImageField should be enough. We shouldn't have to add an Image constraint, should we?
The text was updated successfully, but these errors were encountered: