public static function detectQualityOfJpg($filename)
    {

        //trigger_error('warning test', E_USER_WARNING);

        // Test that file exists in order not to break things.
        if (!file_exists($filename)) {
            // One could argue that it would be better to throw an Exception...?
            return null;
        }

        // Try Imagick extension, if available
        $quality = self::detectQualityOfJpgUsingImagickExtension($filename);

        if (is_null($quality)) {
            $quality = self::detectQualityOfJpgUsingImagickBinary($filename);
        }

        if (is_null($quality)) {
            $quality = self::detectQualityOfJpgUsingGmagickBinary($filename);
        }

        return $quality;
    }
public static function detectQualityOfJpg($filename)
    {

        //trigger_error('warning test', E_USER_WARNING);

        // Test that file exists in order not to break things.
        if (!file_exists($filename)) {
            // One could argue that it would be better to throw an Exception...?
            return null;
        }

        // Try Imagick extension, if available
        $quality = self::detectQualityOfJpgUsingImagickExtension($filename);

        if (is_null($quality)) {
            $quality = self::detectQualityOfJpgUsingImagickBinary($filename);
        }

        if (is_null($quality)) {
            $quality = self::detectQualityOfJpgUsingGmagickBinary($filename);
        }

        return $quality;
    }
public static function detectQualityOfJpg ( $ filename ) { //trigger_error('warning test', E_USER_WARNING); // Test that file exists in order not to break things. if ( ! file_exists ( $ filename ) ) { // One could argue that it would be better to throw an Exception...? return null ; } // Try Imagick extension, if available $ quality = self :: detectQualityOfJpgUsingImagickExtension ( $ filename ) ; if ( is_null ( $ quality ) ) { $ quality = self :: detectQualityOfJpgUsingImagickBinary ( $ filename ) ; } if ( is_null ( $ quality ) ) { $ quality = self :: detectQualityOfJpgUsingGmagickBinary ( $ filename ) ; } return $ quality ; }
Try to detect quality of jpeg.

Note: This method does not throw errors, but might dispatch warnings.
You can use the WarningsIntoExceptions class if it is critical to you that nothing gets "printed"

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