We know the main role, functions and future uses of image processing through the opening chapter.
The focus of learning image processing is to learn the functions of PHP's GD system.
PIt can also create and process images in a variety of formats including GIF, PNG, JPEG, WBMP and XPM. Even more conveniently, PHP can directly output the image data stream to the browser. To use image processing functions in PHP, you need to compile PHP with the GD library. The GD library and PHP may require other libraries, depending on the image format you want to process.
You can use the image functions in PHP to get the size of images in the following formats: JPEG, GIF, PNG, SWF, TIFF and JPEG2000.
To check whether our current machine has the GD extension installed, we can write the first sentence we learned on the first day:
<?php phpinfo(); ?>
Look at the picture below, if the gd option exists, It means that our current machine supports GD to process images:
If you don’t see it, you won’t find it either. You can open gd to process images according to the following steps:
1. Open php.ini (explained in the file upload chapter)
2. In Windows, you need to install the DLL of GD2 The file php_gd2.dll is included in php.ini as an extension. Modify ;extension = php_gd2.dll and remove the preceding semicolon
3. Restart the apache server
4. Execute phpinfo again to try to see if there is a gd extension
Note : If you still encounter problems, you can also ask questions on the official website.