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

declare(strict_types=1);

namespace 
InterventionImageDriversImagickModifiers;

use 
ImagickException;
use 
InterventionImageExceptionsModifierException;
use 
InterventionImageExceptionsStateException;
use 
InterventionImageInterfacesImageInterface;
use 
InterventionImageInterfacesSpecializedInterface;
use 
InterventionImageModifiersRotateModifier as GenericRotateModifier;

class 
RotateModifier extends GenericRotateModifier implements SpecializedInterface
{
    
/**
     * @throws ModifierException
     * @throws StateException
     */
    
public function apply(ImageInterface $image): ImageInterface
    
{
        
$background $this->driver()
            ->
colorProcessor($image)
            ->
export($this->backgroundColor());

        foreach (
$image as $frame) {
            try {
                
$result $frame->native()->rotateImage($background$this->rotationAngle());

                if (
$result === false) {
                    throw new 
ModifierException(
                        
'Failed to apply ' self::class . ', unable to rotate image',
                    );
                }
            } catch (
ImagickException $e) {
                throw new 
ModifierException(
                    
'Failed to apply ' self::class . ', unable to rotate image',
                    
previous$e,
                );
            }
        }

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