private static function detectQualityOfJpgUsingImagickBinary($filename)
    {
        if (function_exists('exec')) {
            // Try Imagick using exec, and routing stderr to stdout (the "2>$1" magic)
            exec("identify -format '%Q' " . escapeshellarg($filename) . " 2>&1", $output, $returnCode);
            //echo 'out:' . print_r($output, true);
            if ((intval($returnCode) == 0) && (is_array($output)) && (count($output) == 1)) {
                return intval($output[0]);
            }
        }
        return null;
    }
private static function detectQualityOfJpgUsingImagickBinary($filename)
    {
        if (function_exists('exec')) {
            // Try Imagick using exec, and routing stderr to stdout (the "2>$1" magic)
            exec("identify -format '%Q' " . escapeshellarg($filename) . " 2>&1", $output, $returnCode);
            //echo 'out:' . print_r($output, true);
            if ((intval($returnCode) == 0) && (is_array($output)) && (count($output) == 1)) {
                return intval($output[0]);
            }
        }
        return null;
    }
private static function detectQualityOfJpgUsingImagickBinary ( $ filename ) { if ( function_exists ( 'exec' ) ) { // Try Imagick using exec, and routing stderr to stdout (the "2>$1" magic) exec ( "identify -format '%Q' " . escapeshellarg ( $ filename ) . " 2>&1" , $ output , $ returnCode ) ; //echo 'out:' . print_r($output, true); if ( ( intval ( $ returnCode ) == 0 ) && ( is_array ( $ output ) ) && ( count ( $ output ) == 1 ) ) { return intval ( $ output [ 0 ] ) ; } } return null ; }
Try to detect quality of jpeg using imagick binary

@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 binary