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
Skill Level Intermediate
- [Voiceover] Hi I'm David Powers in this course I'll show you how to automate the resizing and watermarking of images using PHP. Providing the right sized image has become increasingly important with the proliferation of mobile devices and high pixel density screen resolutions. We'll begin with the basics of loading images into memory, detecting the images mind type, getting its width and height, rescaling it, and saving it to file. Optionally adding a watermark. You'll also see how to deal with images in portrait orientation that report width and height the wrong way round.
Then we'll pull everything together to develop a custom class to batch process images of different sizes and types. The process is nondestructive because PHP always works on a copy of the image. So please join me in resizing and watermarking images with PHP.