PHP resize image on the fly

How to resize an image on the fly with PHP without keeping multiple thumbnails in the server. When we are uploading an image to server we can create thumbnails for each image for different...