#67: Creating Thumbnail Images
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
The 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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access