Something like this https://gist.github.com/egandalf/238d477997da285542a86f9af5c9dc16
Or you could create a validation attribute or IValidate class
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!
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.
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?