Вход Регистрация
Файл: vendor/intervention/image/src/Drivers/Gd/Modifiers/InvertModifier.php
Строк: 44
<?php

declare(strict_types=1);

namespace 
InterventionImageDriversGdModifiers;

use 
InterventionImageExceptionsModifierException;
use 
InterventionImageInterfacesImageInterface;
use 
InterventionImageInterfacesSpecializedInterface;
use 
InterventionImageModifiersInvertModifier as GenericInvertModifier;

class 
InvertModifier extends GenericInvertModifier implements SpecializedInterface
{
    
/**
     * {@inheritdoc}
     *
     * @see ModifierInterface::apply()
     *
     * @throws ModifierException
     */
    
public function apply(ImageInterface $image): ImageInterface
    
{
        foreach (
$image as $frame) {
            
$result imagefilter($frame->native(), IMG_FILTER_NEGATE);
            if (
$result === false) {
                throw new 
ModifierException('Failed to invert image colors');
            }
        }

        return 
$image;
    }
}
Онлайн: 1
Реклама