Файл: vendor/intervention/image/src/Drivers/Imagick/Modifiers/FlipModifier.php
Строк: 50
<?php
declare(strict_types=1);
namespace InterventionImageDriversImagickModifiers;
use ImagickException;
use InterventionImageDirection;
use InterventionImageExceptionsModifierException;
use InterventionImageInterfacesImageInterface;
use InterventionImageInterfacesSpecializedInterface;
use InterventionImageModifiersFlipModifier as GenericFlipModifier;
class FlipModifier extends GenericFlipModifier implements SpecializedInterface
{
/**
* @throws ModifierException
*/
public function apply(ImageInterface $image): ImageInterface
{
foreach ($image as $frame) {
try {
$result = $this->direction === Direction::HORIZONTAL
? $frame->native()->flopImage()
: $frame->native()->flipImage();
if ($result === false) {
throw new ModifierException(
'Failed to apply ' . self::class . ', unable to mirror image',
);
}
} catch (ImagickException $e) {
throw new ModifierException(
'Failed to apply ' . self::class . ', unable to mirror image',
previous: $e,
);
}
}
return $image;
}
}