How do I resize image directly while uploading the image?
Try Max Image Size module

On the module page it says:


  This module will resize uploaded images to be below the set
  dimensions. It is not an image style or other presentation layer
  module. If you want to maintain the original image you should use
  Image Resize Filter or an image style. The use case for this module is
  sites where users may upload very large images, but you do not
  want/need to keep the original.