symfony2admingenerator / FormExtensionsBundle

Symfony2 form extensions for Admingenerator project (also working standalone!)
Other
13 stars 13 forks source link

[Collection Upload] previewFilter and loadImageMaxFileSize #72

Closed pjam closed 7 years ago

pjam commented 8 years ago

When using a preview filter, like one for creating a thumbnail, the option loadImageMaxFileSize should be tested against the result image, but always tests against the original image.

How can we fix that?

bobvandevijver commented 7 years ago

It is not possible to determine the size of the thumbnail before it's generated, but as far as I can see the purpose of this option is to prevent the generation of the thumbnail if the source image is to large. This is probably meant as protection: if somehow a image that't to large has been uploaded, the server is protected against large operations from generating the thumbnail.

So, the solution for your problem would probably be to determine a generic "shrink" factor which applies in your use case, and use that to calculate the maximum file size of the original image.