From the course: PHP: Resizing and Watermarking Images

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Setting output sizes and quality

Setting output sizes and quality - PHP Tutorial

From the course: PHP: Resizing and Watermarking Images

Start my 1-month free trial

Setting output sizes and quality

- [Voiceover] The next stage in building the Resize Images class is to add public methods to set the image sizes and quality. From the technical point of view, it doesn't matter which order, method, definitions are listed in a class definition. But I like to keep all public methods together at the top, so I'm going to insert the Set Output Sizes method after the constructor, so scroll down, find the end of the Constructor. There it is on line 43. Add in some extra space and we're using public function and we'll call it Set Output Sizes. This will take two arguments. The first one needs to be an array, so I'll use a type declaration for that. Call it Sizes, and the second argument will determine whether to use the longer dimension for re-sizing. In other words, to base the new size on the height for images in Portrait Orientation. So I'll call that, Use Longer Dimension. And by default, I'll set it to True, so that makes it an optional argument. Before assigning these sizes to the…

Contents