public function optimize(string $pathToImage, string $pathToOutput = null)
    {
        if(config('media.optimize_image')) {
            ImageOptimizer::optimize($pathToImage, $pathToOutput);
        }
        return $this;
    }
public function optimize(string $pathToImage, string $pathToOutput = null)
    {
        if(config('media.optimize_image')) {
            ImageOptimizer::optimize($pathToImage, $pathToOutput);
        }
        return $this;
    }
public function optimize ( string $ pathToImage , string $ pathToOutput = null ) { if ( config ( 'media.optimize_image' ) ) { ImageOptimizer :: optimize ( $ pathToImage , $ pathToOutput ) ; } return $ this ; }
Compress & optimize an image.

@param string      $pathToImage
@param string|null $pathToOutput

@return $this
Compress & optimize an image .