How to limit image size?

Vote:
 

Is there a way I can warn or prevent authors from uploading an image that's too big?

say I want to max them at 500x500px images. How can I warn them or prevent them from uploading bigger images?

is there an eoiserver way? Or do I have to use an extension?

#267871
Dec 05, 2021 16:26
Vote:
 

Something like this https://gist.github.com/egandalf/238d477997da285542a86f9af5c9dc16 

Or you could create a validation attribute or IValidate class 

#267908
Dec 06, 2021 8:49
Vote:
 

Good alternative is to let them upload it in any size and then scale it automagicallly using either Image processor or image resizer plugin. Add disc cache / CDN to images and you are good to go!

#268113
Dec 09, 2021 14:31
Vote:
 

I would advocate the route of using Image Processor or Image Resizer as well.  This would allow you to upload a single instance of the image and to reuse it in many different sizes which are appropriate to the view port and position within the site.

e.g. Uploading a 1920x1080 image and rendering the url as 'https://www.example.com/globalassets/images/myimage.jpg?w=500&h=500&mode=max' would result in the client receiving a resized version of the image at 500x500.  Cloudflare can be configured to cache images based on unique URL and Querystring combinations so that each size varient is sized once only for the supplied cache duration.

#268268
Dec 12, 2021 0:19
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.