Skip to content

Commit

Permalink
check source file type for png
Browse files Browse the repository at this point in the history
  • Loading branch information
jf-viguier committed Jul 2, 2024
1 parent 2f3092d commit 6793d47
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion classes/ImageManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ public static function resize(
// If the output is PNG, fill with transparency. Else fill with white background.
if (in_array($destinationFileType, ['png', 'webp', 'avif'])) {
// if png color type is 3, the file is paletted (256 colors or less). Change palette to reduce file size
if ($destinationFileType == 'png' && self::getPNGColorType($sourceFile) == 3) {
if ($destinationFileType == 'png' && $sourceFileType == IMAGETYPE_PNG && self::getPNGColorType($sourceFile) == 3) {
imagetruecolortopalette($destImage, false, 255);
} else {
imagealphablending($destImage, false);
Expand Down

0 comments on commit 6793d47

Please sign in to comment.