mirror of
https://github.com/processwire/processwire.git
synced 2025-08-18 12:31:17 +02:00
add option webpQuality
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
* @property bool $interlace
|
* @property bool $interlace
|
||||||
* @property array|string|bool $cropping
|
* @property array|string|bool $cropping
|
||||||
* @property int $quality
|
* @property int $quality
|
||||||
|
* @property int $webpQuality
|
||||||
* @property string $sharpening
|
* @property string $sharpening
|
||||||
* @property float $defaultGamma
|
* @property float $defaultGamma
|
||||||
* @property float $scale
|
* @property float $scale
|
||||||
@@ -60,6 +61,14 @@ abstract class ImageSizerEngine extends WireData implements Module, Configurable
|
|||||||
*/
|
*/
|
||||||
protected $quality = 90;
|
protected $quality = 90;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WebP Image quality setting, 1..100
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
protected $webpQuality = 90;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Image interlace setting, false or true
|
* Image interlace setting, false or true
|
||||||
*
|
*
|
||||||
@@ -219,6 +228,7 @@ abstract class ImageSizerEngine extends WireData implements Module, Configurable
|
|||||||
'cropping',
|
'cropping',
|
||||||
'interlace',
|
'interlace',
|
||||||
'quality',
|
'quality',
|
||||||
|
'webpQuality',
|
||||||
'sharpening',
|
'sharpening',
|
||||||
'defaultGamma',
|
'defaultGamma',
|
||||||
'scale',
|
'scale',
|
||||||
@@ -889,6 +899,22 @@ abstract class ImageSizerEngine extends WireData implements Module, Configurable
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the image quality 1-100 for WebP output, where 100 is highest quality
|
||||||
|
*
|
||||||
|
* @param int $n
|
||||||
|
*
|
||||||
|
* @return $this
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public function setWebpQuality($n) {
|
||||||
|
$n = (int) $n;
|
||||||
|
if($n < 1) $n = 1;
|
||||||
|
if($n > 100) $n = 100;
|
||||||
|
$this->webpQuality = (int) $n;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given an unknown sharpening value, return the string representation of it
|
* Given an unknown sharpening value, return the string representation of it
|
||||||
*
|
*
|
||||||
@@ -1116,6 +1142,7 @@ abstract class ImageSizerEngine extends WireData implements Module, Configurable
|
|||||||
*
|
*
|
||||||
* @param array $options May contain the following (show with default values):
|
* @param array $options May contain the following (show with default values):
|
||||||
* 'quality' => 90,
|
* 'quality' => 90,
|
||||||
|
* 'webpQuality' => 90,
|
||||||
* 'cropping' => true,
|
* 'cropping' => true,
|
||||||
* 'upscaling' => true,
|
* 'upscaling' => true,
|
||||||
* 'autoRotation' => true,
|
* 'autoRotation' => true,
|
||||||
@@ -1148,6 +1175,9 @@ abstract class ImageSizerEngine extends WireData implements Module, Configurable
|
|||||||
case 'quality':
|
case 'quality':
|
||||||
$this->setQuality($value);
|
$this->setQuality($value);
|
||||||
break;
|
break;
|
||||||
|
case 'webpQuality':
|
||||||
|
$this->setWebpQuality($value);
|
||||||
|
break;
|
||||||
case 'cropping':
|
case 'cropping':
|
||||||
$this->setCropping($value);
|
$this->setCropping($value);
|
||||||
break;
|
break;
|
||||||
@@ -1207,6 +1237,7 @@ abstract class ImageSizerEngine extends WireData implements Module, Configurable
|
|||||||
|
|
||||||
$options = array(
|
$options = array(
|
||||||
'quality' => $this->quality,
|
'quality' => $this->quality,
|
||||||
|
'webpQuality' => $this->webpQuality,
|
||||||
'cropping' => $this->cropping,
|
'cropping' => $this->cropping,
|
||||||
'upscaling' => $this->upscaling,
|
'upscaling' => $this->upscaling,
|
||||||
'interlace' => $this->interlace,
|
'interlace' => $this->interlace,
|
||||||
|
Reference in New Issue
Block a user