Is there a way to force ANY image uploaded in Grav via admin plugin to be resized to certain width and auto-height when uploaded? Or even on a field by field basis? Though a global setting would be better.
You can limit the size of the file, but as far as I know, you can not limit width on upload natively.
Is there a reason why you would want your file to have a certain width? I ask because you can easily manipulate image with twig. https://learn.getgrav.org/content/media
I want to resize on upload because I don’t want clients to have to resize image themselves prior to uploading (which is how limiting the filesize works) because many of my clients don’t know how or don’t want the inconvenience - but I also don’t want clients uploading 6000px wide 20mb images when i’m resizing them all with Twig anyway to no wider than 1400px which brings the size from 20mb to about 400kb max. So it’s about server space. I have a couple of very simple websites that didn’t have image resizing from the start and after 2 years are 1.5gb folder size just in images. If there is a function to resize on upload (which is common with CMS’s) then I can resize any image uploaded to just 1400px wide (auto height) and then my images will all be big enough, but not take rediculous amounts of server space.
Even if it’s not possible natively, there’s no reason you couldn’t do a plugin. I don’t immediately see a hook, but it should be easy enough to create a hook that fires once the file is uploaded but before it is fully committed. You could even just do a basic cron job that scans the images folder and cuts down large images.