When you allow users to upload images to your site (see "#54: Uploading Images to a Directory" on #54: Uploading Images to a Directory), you often need a small preview image (called a thumbnail) for inclusion on larger pages and image gallery browsing. This section shows you a function called
mkthumb() that creates thumbnails with the help of GD. To use the function, you need the following:
A PHP-writable directory for writing the thumbnails (if you don't know how to make a directory writable, see "File Permissions" on File Permissions)
The GD library
mkthumb() function takes two parameters: the name of the input image file and the desired name of the thumbnail. You need to independently verify that the image file ...