Were going to be creating it in a function, so that we can re-use this wherever we need to. This particular function saves the thumbnail file to a directory on the server, you could actually skip saving the file and just print out the image itself if you would prefer to do that.