Skip to content

Commit

Permalink
Merge pull request #211 from honzito/fix-forupstream
Browse files Browse the repository at this point in the history
Fixed Webp - quality parameter
  • Loading branch information
JamesHeinrich authored May 19, 2023
2 parents 91ad74c + 92016ae commit d5d307b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions phpthumb.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -2395,6 +2395,10 @@ public function ImageMagickThumbnailToGD() {
}
}
}
// ImageMagic also support quality for webp - but only for version 7.0.8-68 and above
if (($outputFormat=='webp') && $this->q && $this->ImageMagickSwitchAvailable(['quality'])) {
$commandline .= ' -quality '.phpthumb_functions::escapeshellarg_replacement($this->thumbnailQuality);
}
$commandline .= ' '.$outputFormat.':'.phpthumb_functions::escapeshellarg_replacement($IMtempfilename);
if (!$this->iswindows) {
$commandline .= ' 2>&1';
Expand Down Expand Up @@ -3717,8 +3721,8 @@ public function SetCacheFilename() {
$ParametersString .= '_'.$key.substr(md5($this->$key), 0, 4);
}
}
if ($this->thumbnailFormat == 'jpeg') {
// only JPEG output has variable quality option
if (in_array($this->thumbnailFormat, ['jpeg','webp'])) {
// only JPEG and WEBP output has variable quality option
$ParametersString .= '_q'. (int) $this->thumbnailQuality;
}
$this->DebugMessage('SetCacheFilename() _par set from md5('.$ParametersString.')', __FILE__, __LINE__);
Expand Down

0 comments on commit d5d307b

Please sign in to comment.