Skip to content

Commit

Permalink
Cleanup getJpegQuality()
Browse files Browse the repository at this point in the history
  • Loading branch information
J0WI committed Sep 2, 2022
1 parent 7c38a21 commit 65eab5b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
10 changes: 2 additions & 8 deletions lib/private/Image/Gmagick.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ protected function _write($filePath = null, $mimeType = null): bool {
break;
case IMAGETYPE_JPEG:
$compression = Gmagick::COMPRESSION_JPEG;
$quality = $this->getJpegQuality();
if ($quality !== null) {
$this->resource->setImageCompressionQuality($quality);
}
$this->resource->setImageCompressionQuality($this->getJpegQuality());
break;
case IMAGETYPE_PNG:
$compression = Gmagick::COMPRESSION_ZIP;
Expand Down Expand Up @@ -134,10 +131,7 @@ public function data(): ?string {
break;
case "image/jpeg":
$compression = Gmagick::COMPRESSION_JPEG;
$quality = $this->getJpegQuality();
if ($quality !== null) {
$this->resource->setImageCompressionQuality($quality);
}
$this->resource->setImageCompressionQuality($this->getJpegQuality());
break;
case "image/gif":
$compression = Gmagick::COMPRESSION_LZW;
Expand Down
10 changes: 2 additions & 8 deletions lib/private/Image/Imagick.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ protected function _write($filePath = null, $mimeType = null): bool {
break;
case IMAGETYPE_JPEG:
$compression = Imagick::COMPRESSION_JPEG;
$quality = $this->getJpegQuality();
if ($quality !== null) {
$this->resource->setImageCompressionQuality($quality);
}
$this->resource->setImageCompressionQuality($this->getJpegQuality());
break;
case IMAGETYPE_PNG:
$compression = Imagick::COMPRESSION_ZIP;
Expand Down Expand Up @@ -134,10 +131,7 @@ public function data(): ?string {
break;
case "image/jpeg":
$compression = Imagick::COMPRESSION_JPEG;
$quality = $this->getJpegQuality();
if ($quality !== null) {
$this->resource->setImageCompressionQuality($quality);
}
$this->resource->setImageCompressionQuality($this->getJpegQuality());
break;
case "image/gif":
$compression = Imagick::COMPRESSION_LZW;
Expand Down

0 comments on commit 65eab5b

Please sign in to comment.