Skip to content

Commit

Permalink
Ensured that the package icon is always in the required jpeg format
Browse files Browse the repository at this point in the history
  • Loading branch information
retroluxfilm authored and retroluxfilm committed Mar 25, 2022
1 parent 5ea6695 commit 0647f8c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Package/PackageHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
use finfo;
use Imagick;
use ImagickException;
use ImagickPixel;
use InvalidArgumentException;


Expand Down Expand Up @@ -153,6 +154,15 @@ public static function createThumbnail(string $logoImageData): string
$image = new Imagick();
$image->readImageBlob($logoImageData);
$image->cropThumbnailImage(self::THUMBNAIL_SIZE, self::THUMBNAIL_SIZE);

//ensures that the thumbnail is in jpeg data format as it is currently required for OMM remote repositories
$image->setImageFormat('jpeg');
$image->setImageCompression(imagick::COMPRESSION_JPEG);
$image->setCompressionQuality(60);

// set default background color in case there is an alpha image in the source
$image->setImageBackgroundColor(new ImagickPixel('white'));

$scaledImage = $image->getImageBlob();
$image->destroy();
return $scaledImage;
Expand Down

0 comments on commit 0647f8c

Please sign in to comment.