1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-21 13:11:18 +02:00

Refactor BinaryImageDecoder

This commit is contained in:
Oliver Vogel
2024-01-27 18:02:44 +01:00
parent 19578de8d4
commit e1b4649b86

View File

@@ -15,7 +15,7 @@ use Intervention\Image\Exceptions\DecoderException;
use Intervention\Image\Image; use Intervention\Image\Image;
use Intervention\Image\Modifiers\AlignRotationModifier; use Intervention\Image\Modifiers\AlignRotationModifier;
class BinaryImageDecoder extends AbstractDecoder implements DecoderInterface class BinaryImageDecoder extends GdImageDecoder implements DecoderInterface
{ {
use CanDecodeGif; use CanDecodeGif;
@@ -53,19 +53,11 @@ class BinaryImageDecoder extends AbstractDecoder implements DecoderInterface
throw new DecoderException('Unable to decode input'); throw new DecoderException('Unable to decode input');
} }
if (!imageistruecolor($gd)) { // create image instance
imagepalettetotruecolor($gd); $image = parent::decode($gd);
}
imagesavealpha($gd, true);
// build image instance // extract & set exif data
$image = new Image( $image->setExif($this->extractExifData($input));
new Driver(),
new Core([
new Frame($gd)
]),
$this->extractExifData($input)
);
try { try {
// set mediaType on origin // set mediaType on origin