In addition to the potential issue I mentioned before with this not making sure both width and height are inside the restrictions, this will also stretch any images that are smaller than the max up to the max size. This may not be desirable, but may not be a concern if the people uploading images know to keep them at the right size.