Uploading and resizing an image file with PHP can be accomplished by using the following provided source code. This PHP code example will work with JPEG, GIF, and PNG image files. The following code example shows when submitting from an HTML field input field with the name attribute: promo_image.