contao / contao

Contao Open Source CMS
https://contao.org
GNU Lesser General Public License v3.0
329 stars 156 forks source link

Resize too large images instead of rejecting the upload #3172

Open ausi opened 3 years ago

ausi commented 3 years ago

It should be possible to set the maximum image width and height in the settings of every FormFileUpload as they may be different in every form.

Also a checkbox for “Resize too large images instead of rejecting the upload” would be great.

bennyborn commented 2 years ago

If this gets implemented I'd like to add that I'd appreciate the addition of the postUpload-Hook so our extension can take care of those uploads as well (see https://github.com/numero2/contao-proper-filenames/issues/5) 🙂

fritzmg commented 2 years ago

That should already be possible with the validateFormField hook, is it not?

bennyborn commented 2 years ago

🤔 I guess you're right. Nonetheless I think adding that Hook in there would be more convenient.

bennyborn commented 2 years ago

Quick follow-up: While working it out with validateFormField was possible it seems a bit cumbersone because we have to modify the session afterwards. So the implementation of the postUpload-Hook somewhere around

https://github.com/contao/contao/blob/66ed49f9c4ecfb93c562072876b65a21a8a3ba72/core-bundle/src/Resources/contao/forms/FormFileUpload.php#L263-L265

would still be more convenient.

leofeyer commented 2 years ago

Maximum image width and height per upload field has been implemented in #3628. So now only the "Resize too large images instead of rejecting the upload" checkbox is missing.