src/Manipulators/Encode.php
public function getFormat(Image $image)
    {
        $allowed = [
            'gif' => 'image/gif',
            'jpg' => 'image/jpeg',
            'pjpg' => 'image/jpeg',
            'png' => 'image/png',
            'webp' => 'image/webp',
        ];

        if (array_key_exists($this->fm, $allowed)) {
            return $this->fm;
        }

        if ($format = array_search($image->mime(), $allowed, true)) {
            return $format;
        }

        return 'jpg';
    }
public function getFormat(Image $image)
    {
        $allowed = [
            'gif' => 'image/gif',
            'jpg' => 'image/jpeg',
            'pjpg' => 'image/jpeg',
            'png' => 'image/png',
            'webp' => 'image/webp',
        ];

        if (array_key_exists($this->fm, $allowed)) {
            return $this->fm;
        }

        if ($format = array_search($image->mime(), $allowed, true)) {
            return $format;
        }

        return 'jpg';
    }
public function getFormat ( Image $ image ) { $ allowed = [ 'gif' => 'image/gif' , 'jpg' => 'image/jpeg' , 'pjpg' => 'image/jpeg' , 'png' => 'image/png' , 'webp' => 'image/webp' , ] ; if ( array_key_exists ( $ this -> fm , $ allowed ) ) { return $ this -> fm ; } if ( $ format = array_search ( $ image -> mime ( ) , $ allowed , true ) ) { return $ format ; } return 'jpg' ; }
Resolve format.
@param  Image  $image The source image.
@return string The resolved format.
Resolve format .