JBZoo\Utils\Image::quality PHP Method

quality() public static method

public static quality ( string $percent ) : integer
$percent string
return integer
    public static function quality($percent)
    {
        return self::range($percent, 0, 100);
    }

Usage Example

Beispiel #1
0
 /**
  * Save image to file
  *
  * @param string $filename
  * @param int    $quality
  * @return bool
  *
  * @throws Exception
  */
 protected function _save($filename, $quality)
 {
     $quality = $quality ?: $this->_quality;
     $quality = Helper::quality($quality);
     $format = strtolower(FS::ext($filename));
     if (!Helper::isSupportedFormat($format)) {
         $format = $this->_mime;
     }
     $filename = FS::clean($filename);
     // Create the image
     $result = $this->_renderImageByFormat($format, $filename, $quality);
     $this->loadFile($filename);
     $this->_quality = $quality;
     return $result;
 }