PHP Function ImagesaveAlpha
Managing images on your website can be time-consuming and error-prone, but with a little bit of PHP knowledge you can automate most image manipulation tasks. This article will introduce you to the GD library (short for Graphic Draw), which comes with PHP and handles almost all of your basic image manipulation needs.
GD supports most common image formats, including GIF, JPEG, PNG, TIFF and bmp. To get started working with image files, you must first make sure that GD is activated in your web server/host. You can check if it is by running
Most image manipulation functions in GD require a function name and one or more arguments. Arguments are like variables, but you must specify them after the function name and within parenthesis. The imagerotate() function, for example, requires a parameter that specifies the angle of rotation.
Aside from resizing, cropping and rotating images, GD has a number of other image processing functions. For example, the imagepng() function will create a PNG version of an image and can also be used to convert any other file type to a PNG. The imagecolorsforindex() function allows you to obtain the index of a particular color in an image.
You can also work with meta data stored in the headers of images by using the xexif functions. These can be accessed only if your PHP installation is compiled with the --enable-exif option.