PHP resize image before upload

How to resize an image before uploading to the server with PHP and keep the resized image without saving the original image. Image uploading and resizing is a required process in websites and systems...