Introduction
An often encountered problem when creating a content management system for a website is the automatic generation of thumbnails after the images have been uploaded.
If you've used sites such as flickr or facebook, you've noticed how the photos you upload are reduced in size to a preview thumbnail size. Reading this tutorial, you will learn how to do this for your own website.
We assume you have already taken care of the file uploading part, which is covered in File uploads in PHP .
Using the gd2 functions
To achieve this, you should make sure you have the "gd2" library PHP extension. If you're not sure you have it running on your web server, please read Checking if your system has a PHP extension installed .
The gd2 library provides an API allowing some image manipulation functions, such as reading an image, resizing, cutting, and others. It supports most of the formats interesting for the web: png, jpeg and gif.
To see how to create tutorials using gd2, follow Creating Thumbnails in PHP with gd2 .
Oher methods
Are you familiar with other methods of image rescaling using PHP? Please contribute!