I have a submit form where users can upload images. What I want is to resize the images so the width will be no more than 300px and to save the resized image ( I don't want to keep the original).

How would I do that?