private static function detectQualityOfJpgUsingImagickExtension($filename)
    {
        if (extension_loaded('imagick') && class_exists('\\Imagick')) {
            try {
                $img = new \Imagick($filename);

                // The required function is available as from PECL imagick v2.2.2
                if (method_exists($img, 'getImageCompressionQuality')) {
                    return $img->getImageCompressionQuality();
                }
            } catch (\Exception $e) {
                // Well well, it just didn't work out.
                // - But perhaps next method will work...
            }
        }
        return null;
    }
private static function detectQualityOfJpgUsingImagickExtension($filename)
    {
        if (extension_loaded('imagick') && class_exists('\\Imagick')) {
            try {
                $img = new \Imagick($filename);

                // The required function is available as from PECL imagick v2.2.2
                if (method_exists($img, 'getImageCompressionQuality')) {
                    return $img->getImageCompressionQuality();
                }
            } catch (\Exception $e) {
                // Well well, it just didn't work out.
                // - But perhaps next method will work...
            }
        }
        return null;
    }
private static function detectQualityOfJpgUsingImagickExtension ( $ filename ) { if ( extension_loaded ( 'imagick' ) && class_exists ( '\\Imagick' ) ) { try { $ img = new \ Imagick ( $ filename ) ; // The required function is available as from PECL imagick v2.2.2 if ( method_exists ( $ img , 'getImageCompressionQuality' ) ) { return $ img -> getImageCompressionQuality ( ) ; } } catch ( \ Exception $ e ) { // Well well, it just didn't work out. // - But perhaps next method will work... } } return null ; }
Try to detect quality of jpeg using imagick extension

@param  string  $filename  A complete file path to file to be examined
@return int|null  Quality, or null if it was not possible to detect quality
Try to detect quality of jpeg using imagick extension