Файл: vendor/intervention/image/src/Drivers/Gd/Modifiers/GrayscaleModifier.php
Строк: 41
<?php
declare(strict_types=1);
namespace InterventionImageDriversGdModifiers;
use InterventionImageExceptionsModifierException;
use InterventionImageInterfacesImageInterface;
use InterventionImageInterfacesSpecializedInterface;
use InterventionImageModifiersGrayscaleModifier as GenericGrayscaleModifier;
class GrayscaleModifier extends GenericGrayscaleModifier implements SpecializedInterface
{
/**
* {@inheritdoc}
*
* @see ModifierInterface::apply()
*
* @throws ModifierException
*/
public function apply(ImageInterface $image): ImageInterface
{
foreach ($image as $frame) {
$result = imagefilter($frame->native(), IMG_FILTER_GRAYSCALE);
if ($result === false) {
throw new ModifierException(
'Failed to apply ' . self::class . ', unable to transform image to grayscale',
);
}
}
return $image;
}
}