Join David Powers for an in-depth discussion in this video What you should know before watching this course, part of Resizing and Watermarking Images with PHP.
- View Offline
- [Voiceover] Let's start with a quick review of what you need to follow this course. The main requirement is a PHP server that supports the GD extension. Most popular distributions of PHP have GD enabled but I explain in chapter 1 how to check whether it's supported on your server. If possible, you should be using a minimum of PHP 5.5.19 a minimum of PHP 5.5.19 or PHP 5.6.3. or PHP 5.6.3. or PHP 5.6.3. This is because they support the image scale function, which not only makes resizing images incredibly easy it also produces sharper results than other functions.
Of course PHP 7 is fine, that's what I'm using. However, most of the code in this course will run on older versions of PHP. I've set 5.4 as the minimum because I use the shorthand array syntax throughout. You don't need any prior experience of using GD functions but you should be familiar with PHP syntax. In chapter 2, I assume that you understand the basics of how to build a custom class. And that's really all you need.
Chapter 2 pulls everything together, using a custom PHP class that can batch process multiple images, automatically detect the correct MIME type, generate custom sizes, and add an optional watermark.
- Scaling an image with imagescale()
- Resizing an image with imagecopyresampled()
- Adding watermarks
- Correcting orientation
- Batch processing images