this function is meant to resize an image uploaded by an html form as needed (making it a square, a horizontal or vertical rectangle, or simply resizing it keeping the aspect ratio).
all the new sizes of the image (saved inside the $newSize array) can be edited as needed.
the image then must be created using the imagejpeg() or imagepng() function