src/ImageOptimizer.php
public function optimizeImage($filepath)
    {
        $fileExtension = $this->extensions[mime_content_type($filepath)];

        $transformHandler = config('imageoptimizer.transform_handler');

        if (!isset($transformHandler[$fileExtension])) {
            throw new \Exception('TransformHandler for file extension: "' . $fileExtension . '" was not found');
        }

        $this->get($transformHandler[$fileExtension])->optimize($filepath);
    }
public function optimizeImage($filepath)
    {
        $fileExtension = $this->extensions[mime_content_type($filepath)];

        $transformHandler = config('imageoptimizer.transform_handler');

        if (!isset($transformHandler[$fileExtension])) {
            throw new \Exception('TransformHandler for file extension: "' . $fileExtension . '" was not found');
        }

        $this->get($transformHandler[$fileExtension])->optimize($filepath);
    }
public function optimizeImage ( $ filepath ) { $ fileExtension = $ this -> extensions [ mime_content_type ( $ filepath ) ] ; $ transformHandler = config ( 'imageoptimizer.transform_handler' ) ; if ( ! isset ( $ transformHandler [ $ fileExtension ] ) ) { throw new \ Exception ( 'TransformHandler for file extension: "' . $ fileExtension . '" was not found' ) ; } $ this -> get ( $ transformHandler [ $ fileExtension ] ) -> optimize ( $ filepath ) ; }
Opitimize a image.

@param $filepath
@throws \Exception
Opitimize a image .