Ben,
If files are being uploaded, then why not use an image manipulator as soon as the file gets uploaded. ImageMagick has a mogrify function, that can adjust image sizes, maintain aspect ratios and only adjust if images are larger than the required size
eg
mogrify -geometry 400x225> image.jpg
will reduce the image proportionally until one of the limits is reached (ie 400 high OR 225 wide) ONLY if the image is larger than 400x225.
Similarly, if you don't care about the final width but need to reduce to 400 heigh maintaining the same aspect ratio:
mogrify -geometry 400> image.jpg
or vice versa for width:
mogrify -geometry x225> image.jpg
hope it helps