/** * Saves the image to disk. If the second param is provided, will try to compress the image * using JPEG compression. * * The format will be decided based on the extension used for the filename. If, for instance, * a "img.png" is provided, the image will be saved as PNG and the compression will not take * affect. * * @param string $path The file path to save the image. * @param int $jpeg_quality The quality for JPEG files, 1 to 100 where 100 means no * compression (higher quality and bigger file). * * @return $this */ public function write($path, $jpeg_quality = null) { $this->resource->write($path, $jpeg_quality); return $this; }