mirror of
https://github.com/Intervention/image.git
synced 2025-08-06 13:56:30 +02:00
Add decoder and encoder thrown exception
This commit is contained in:
@@ -32,6 +32,7 @@ abstract class AbstractInputHandler implements InputHandlerInterface
|
|||||||
* Stack the decoder array into a nested decoder object
|
* Stack the decoder array into a nested decoder object
|
||||||
*
|
*
|
||||||
* @return AbstractDecoder
|
* @return AbstractDecoder
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
protected function chain(): AbstractDecoder
|
protected function chain(): AbstractDecoder
|
||||||
{
|
{
|
||||||
|
@@ -14,6 +14,7 @@ abstract class AbstractDecoder extends GenericAbstractDecoder
|
|||||||
*
|
*
|
||||||
* @param string $filepath
|
* @param string $filepath
|
||||||
* @return string
|
* @return string
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
protected function getMediaTypeByFilePath(string $filepath): string
|
protected function getMediaTypeByFilePath(string $filepath): string
|
||||||
{
|
{
|
||||||
@@ -35,6 +36,7 @@ abstract class AbstractDecoder extends GenericAbstractDecoder
|
|||||||
*
|
*
|
||||||
* @param string $data
|
* @param string $data
|
||||||
* @return string
|
* @return string
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
protected function getMediaTypeByBinary(string $data): string
|
protected function getMediaTypeByBinary(string $data): string
|
||||||
{
|
{
|
||||||
|
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace Intervention\Image\Drivers\Gd;
|
namespace Intervention\Image\Drivers\Gd;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\AbstractDriver;
|
use Intervention\Image\Drivers\AbstractDriver;
|
||||||
|
use Intervention\Image\Exceptions\DecoderException;
|
||||||
use Intervention\Image\Exceptions\RuntimeException;
|
use Intervention\Image\Exceptions\RuntimeException;
|
||||||
use Intervention\Image\Image;
|
use Intervention\Image\Image;
|
||||||
use Intervention\Image\Interfaces\ColorInterface;
|
use Intervention\Image\Interfaces\ColorInterface;
|
||||||
@@ -79,6 +80,9 @@ class Driver extends AbstractDriver
|
|||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws DecoderException
|
||||||
|
*/
|
||||||
public function add($source, float $delay = 1): self
|
public function add($source, float $delay = 1): self
|
||||||
{
|
{
|
||||||
$this->core->add(
|
$this->core->add(
|
||||||
|
@@ -7,6 +7,7 @@ namespace Intervention\Image\Drivers\Gd\Encoders;
|
|||||||
use Intervention\Gif\Builder as GifBuilder;
|
use Intervention\Gif\Builder as GifBuilder;
|
||||||
use Intervention\Image\Drivers\DriverSpecializedEncoder;
|
use Intervention\Image\Drivers\DriverSpecializedEncoder;
|
||||||
use Intervention\Image\EncodedImage;
|
use Intervention\Image\EncodedImage;
|
||||||
|
use Intervention\Image\Exceptions\EncoderException;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
|
|
||||||
class GifEncoder extends DriverSpecializedEncoder
|
class GifEncoder extends DriverSpecializedEncoder
|
||||||
@@ -25,6 +26,9 @@ class GifEncoder extends DriverSpecializedEncoder
|
|||||||
return new EncodedImage($data, 'image/gif');
|
return new EncodedImage($data, 'image/gif');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws EncoderException
|
||||||
|
*/
|
||||||
protected function encodeAnimated(ImageInterface $image): EncodedImage
|
protected function encodeAnimated(ImageInterface $image): EncodedImage
|
||||||
{
|
{
|
||||||
$builder = GifBuilder::canvas(
|
$builder = GifBuilder::canvas(
|
||||||
|
@@ -6,6 +6,7 @@ namespace Intervention\Image\Drivers\Gd\Modifiers;
|
|||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
use Intervention\Image\Drivers\DriverSpecialized;
|
||||||
use Intervention\Image\Drivers\Gd\Frame;
|
use Intervention\Image\Drivers\Gd\Frame;
|
||||||
|
use Intervention\Image\Exceptions\DecoderException;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Geometry\Point;
|
use Intervention\Image\Geometry\Point;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Interfaces\ModifierInterface;
|
||||||
@@ -32,6 +33,9 @@ class FillModifier extends DriverSpecialized implements ModifierInterface
|
|||||||
return $image;
|
return $image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws DecoderException
|
||||||
|
*/
|
||||||
private function color(ImageInterface $image): int
|
private function color(ImageInterface $image): int
|
||||||
{
|
{
|
||||||
return $this->driver()->colorProcessor($image->colorspace())->colorToNative(
|
return $this->driver()->colorProcessor($image->colorspace())->colorToNative(
|
||||||
|
@@ -7,6 +7,7 @@ namespace Intervention\Image\Drivers\Imagick;
|
|||||||
use Imagick;
|
use Imagick;
|
||||||
use ImagickPixel;
|
use ImagickPixel;
|
||||||
use Intervention\Image\Drivers\AbstractDriver;
|
use Intervention\Image\Drivers\AbstractDriver;
|
||||||
|
use Intervention\Image\Exceptions\DecoderException;
|
||||||
use Intervention\Image\Exceptions\RuntimeException;
|
use Intervention\Image\Exceptions\RuntimeException;
|
||||||
use Intervention\Image\Image;
|
use Intervention\Image\Image;
|
||||||
use Intervention\Image\Interfaces\ColorInterface;
|
use Intervention\Image\Interfaces\ColorInterface;
|
||||||
@@ -81,6 +82,9 @@ class Driver extends AbstractDriver
|
|||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws DecoderException
|
||||||
|
*/
|
||||||
public function add($source, float $delay = 1): self
|
public function add($source, float $delay = 1): self
|
||||||
{
|
{
|
||||||
$native = $this->driver->handleInput($source)->core()->native();
|
$native = $this->driver->handleInput($source)->core()->native();
|
||||||
|
@@ -4,6 +4,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Exceptions;
|
namespace Intervention\Image\Exceptions;
|
||||||
|
|
||||||
class AnimationException extends \RuntimeException
|
class AnimationException extends RuntimeException
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Exceptions;
|
namespace Intervention\Image\Exceptions;
|
||||||
|
|
||||||
class ColorException extends \RuntimeException
|
class ColorException extends RuntimeException
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Exceptions;
|
namespace Intervention\Image\Exceptions;
|
||||||
|
|
||||||
class DecoderException extends \RuntimeException
|
class DecoderException extends RuntimeException
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Exceptions;
|
namespace Intervention\Image\Exceptions;
|
||||||
|
|
||||||
class EncoderException extends \RuntimeException
|
class EncoderException extends RuntimeException
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Exceptions;
|
namespace Intervention\Image\Exceptions;
|
||||||
|
|
||||||
class FontException extends \RuntimeException
|
class FontException extends RuntimeException
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Exceptions;
|
namespace Intervention\Image\Exceptions;
|
||||||
|
|
||||||
class GeometryException extends \RuntimeException
|
class GeometryException extends RuntimeException
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Exceptions;
|
namespace Intervention\Image\Exceptions;
|
||||||
|
|
||||||
class InputException extends \RuntimeException
|
class InputException extends RuntimeException
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Exceptions;
|
namespace Intervention\Image\Exceptions;
|
||||||
|
|
||||||
class NotSupportedException extends \RuntimeException
|
class NotSupportedException extends RuntimeException
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Exceptions;
|
namespace Intervention\Image\Exceptions;
|
||||||
|
|
||||||
class NotWritableException extends \RuntimeException
|
class NotWritableException extends RuntimeException
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image;
|
namespace Intervention\Image;
|
||||||
|
|
||||||
|
use Intervention\Image\Exceptions\RuntimeException;
|
||||||
use Traversable;
|
use Traversable;
|
||||||
use Intervention\Image\Analyzers\ColorspaceAnalyzer;
|
use Intervention\Image\Analyzers\ColorspaceAnalyzer;
|
||||||
use Intervention\Image\Analyzers\HeightAnalyzer;
|
use Intervention\Image\Analyzers\HeightAnalyzer;
|
||||||
@@ -892,6 +893,7 @@ final class Image implements ImageInterface
|
|||||||
*
|
*
|
||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
* @return EncodedImageInterface
|
* @return EncodedImageInterface
|
||||||
|
* @throws RuntimeException
|
||||||
*/
|
*/
|
||||||
public function toJpg(mixed ...$options): EncodedImageInterface
|
public function toJpg(mixed ...$options): EncodedImageInterface
|
||||||
{
|
{
|
||||||
@@ -913,6 +915,7 @@ final class Image implements ImageInterface
|
|||||||
*
|
*
|
||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
* @return EncodedImageInterface
|
* @return EncodedImageInterface
|
||||||
|
* @throws RuntimeException
|
||||||
*/
|
*/
|
||||||
public function toJp2(mixed ...$options): EncodedImageInterface
|
public function toJp2(mixed ...$options): EncodedImageInterface
|
||||||
{
|
{
|
||||||
@@ -963,6 +966,7 @@ final class Image implements ImageInterface
|
|||||||
* Alias if self::toBitmap()
|
* Alias if self::toBitmap()
|
||||||
*
|
*
|
||||||
* @return EncodedImageInterface
|
* @return EncodedImageInterface
|
||||||
|
* @throws RuntimeException
|
||||||
*/
|
*/
|
||||||
public function toBmp(mixed ...$options): EncodedImageInterface
|
public function toBmp(mixed ...$options): EncodedImageInterface
|
||||||
{
|
{
|
||||||
@@ -994,6 +998,7 @@ final class Image implements ImageInterface
|
|||||||
*
|
*
|
||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
* @return EncodedImageInterface
|
* @return EncodedImageInterface
|
||||||
|
* @throws RuntimeException
|
||||||
*/
|
*/
|
||||||
public function toTif(mixed ...$options): EncodedImageInterface
|
public function toTif(mixed ...$options): EncodedImageInterface
|
||||||
{
|
{
|
||||||
|
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image;
|
namespace Intervention\Image;
|
||||||
|
|
||||||
|
use Intervention\Image\Exceptions\DecoderException;
|
||||||
use Intervention\Image\Interfaces\DriverInterface;
|
use Intervention\Image\Interfaces\DriverInterface;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Drivers\Gd\Driver as GdDriver;
|
use Intervention\Image\Drivers\Gd\Driver as GdDriver;
|
||||||
@@ -88,6 +89,7 @@ final class ImageManager
|
|||||||
* @param mixed $input
|
* @param mixed $input
|
||||||
* @param string|array|DecoderInterface $decoders
|
* @param string|array|DecoderInterface $decoders
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function read(mixed $input, string|array|DecoderInterface $decoders = []): ImageInterface
|
public function read(mixed $input, string|array|DecoderInterface $decoders = []): ImageInterface
|
||||||
{
|
{
|
||||||
|
@@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Interfaces;
|
namespace Intervention\Image\Interfaces;
|
||||||
|
|
||||||
|
use Intervention\Image\Exceptions\DecoderException;
|
||||||
|
|
||||||
interface DecoderInterface
|
interface DecoderInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -11,6 +13,7 @@ interface DecoderInterface
|
|||||||
*
|
*
|
||||||
* @param mixed $input
|
* @param mixed $input
|
||||||
* @return ImageInterface|ColorInterface
|
* @return ImageInterface|ColorInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function decode(mixed $input): ImageInterface|ColorInterface;
|
public function decode(mixed $input): ImageInterface|ColorInterface;
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Interfaces;
|
namespace Intervention\Image\Interfaces;
|
||||||
|
|
||||||
|
use Intervention\Image\Exceptions\DecoderException;
|
||||||
|
|
||||||
interface DriverInterface
|
interface DriverInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -52,6 +54,7 @@ interface DriverInterface
|
|||||||
* @param mixed $input
|
* @param mixed $input
|
||||||
* @param array $decoders
|
* @param array $decoders
|
||||||
* @return ImageInterface|ColorInterface
|
* @return ImageInterface|ColorInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function handleInput(mixed $input, array $decoders = []): ImageInterface|ColorInterface;
|
public function handleInput(mixed $input, array $decoders = []): ImageInterface|ColorInterface;
|
||||||
|
|
||||||
|
@@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Interfaces;
|
namespace Intervention\Image\Interfaces;
|
||||||
|
|
||||||
|
use Intervention\Image\Exceptions\EncoderException;
|
||||||
|
|
||||||
interface EncoderInterface
|
interface EncoderInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -11,6 +13,7 @@ interface EncoderInterface
|
|||||||
*
|
*
|
||||||
* @param ImageInterface $image
|
* @param ImageInterface $image
|
||||||
* @return EncodedImageInterface
|
* @return EncodedImageInterface
|
||||||
|
* @throws EncoderException
|
||||||
*/
|
*/
|
||||||
public function encode(ImageInterface $image): EncodedImageInterface;
|
public function encode(ImageInterface $image): EncodedImageInterface;
|
||||||
}
|
}
|
||||||
|
@@ -6,6 +6,8 @@ namespace Intervention\Image\Interfaces;
|
|||||||
|
|
||||||
use Countable;
|
use Countable;
|
||||||
use Intervention\Image\Encoders\AutoEncoder;
|
use Intervention\Image\Encoders\AutoEncoder;
|
||||||
|
use Intervention\Image\Exceptions\DecoderException;
|
||||||
|
use Intervention\Image\Exceptions\EncoderException;
|
||||||
use Intervention\Image\Origin;
|
use Intervention\Image\Origin;
|
||||||
use IteratorAggregate;
|
use IteratorAggregate;
|
||||||
|
|
||||||
@@ -66,6 +68,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param EncoderInterface $encoder
|
* @param EncoderInterface $encoder
|
||||||
* @return EncodedImageInterface
|
* @return EncodedImageInterface
|
||||||
|
* @throws EncoderException
|
||||||
*/
|
*/
|
||||||
public function encode(EncoderInterface $encoder = new AutoEncoder()): EncodedImageInterface;
|
public function encode(EncoderInterface $encoder = new AutoEncoder()): EncodedImageInterface;
|
||||||
|
|
||||||
@@ -75,6 +78,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param null|string $path
|
* @param null|string $path
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws EncoderException
|
||||||
*/
|
*/
|
||||||
public function save(?string $path = null, ...$options): self;
|
public function save(?string $path = null, ...$options): self;
|
||||||
|
|
||||||
@@ -83,6 +87,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param ModifierInterface $modifier
|
* @param ModifierInterface $modifier
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function modify(ModifierInterface $modifier): self;
|
public function modify(ModifierInterface $modifier): self;
|
||||||
|
|
||||||
@@ -111,6 +116,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param int|string $position
|
* @param int|string $position
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function removeAnimation(int|string $position = 0): self;
|
public function removeAnimation(int|string $position = 0): self;
|
||||||
|
|
||||||
@@ -120,6 +126,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param int $offset
|
* @param int $offset
|
||||||
* @param null|int $length
|
* @param null|int $length
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function sliceAnimation(int $offset = 0, ?int $length = null): self;
|
public function sliceAnimation(int $offset = 0, ?int $length = null): self;
|
||||||
|
|
||||||
@@ -166,6 +173,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param float $x
|
* @param float $x
|
||||||
* @param float $y
|
* @param float $y
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function setResolution(float $x, float $y): self;
|
public function setResolution(float $x, float $y): self;
|
||||||
|
|
||||||
@@ -181,6 +189,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param string|ColorspaceInterface $colorspace
|
* @param string|ColorspaceInterface $colorspace
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function setColorspace(string|ColorspaceInterface $colorspace): self;
|
public function setColorspace(string|ColorspaceInterface $colorspace): self;
|
||||||
|
|
||||||
@@ -217,6 +226,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param mixed $color
|
* @param mixed $color
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function setBlendingColor(mixed $color): self;
|
public function setBlendingColor(mixed $color): self;
|
||||||
|
|
||||||
@@ -225,6 +235,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param mixed $color
|
* @param mixed $color
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function blendTransparency(mixed $color = null): self;
|
public function blendTransparency(mixed $color = null): self;
|
||||||
|
|
||||||
@@ -240,6 +251,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param ProfileInterface $profile
|
* @param ProfileInterface $profile
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function setProfile(ProfileInterface $profile): self;
|
public function setProfile(ProfileInterface $profile): self;
|
||||||
|
|
||||||
@@ -247,6 +259,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Remove ICC color profile from the current image
|
* Remove ICC color profile from the current image
|
||||||
*
|
*
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function removeProfile(): self;
|
public function removeProfile(): self;
|
||||||
|
|
||||||
@@ -256,6 +269,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param int $limit
|
* @param int $limit
|
||||||
* @param mixed $background
|
* @param mixed $background
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function reduceColors(int $limit, mixed $background = 'transparent'): self;
|
public function reduceColors(int $limit, mixed $background = 'transparent'): self;
|
||||||
|
|
||||||
@@ -264,6 +278,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param int $amount
|
* @param int $amount
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function sharpen(int $amount = 10): self;
|
public function sharpen(int $amount = 10): self;
|
||||||
|
|
||||||
@@ -271,6 +286,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Turn image into a greyscale version
|
* Turn image into a greyscale version
|
||||||
*
|
*
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function greyscale(): self;
|
public function greyscale(): self;
|
||||||
|
|
||||||
@@ -279,6 +295,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param int $level
|
* @param int $level
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function brightness(int $level): self;
|
public function brightness(int $level): self;
|
||||||
|
|
||||||
@@ -287,6 +304,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param int $level
|
* @param int $level
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function contrast(int $level): self;
|
public function contrast(int $level): self;
|
||||||
|
|
||||||
@@ -295,6 +313,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param float $gamma
|
* @param float $gamma
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function gamma(float $gamma): self;
|
public function gamma(float $gamma): self;
|
||||||
|
|
||||||
@@ -305,6 +324,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param int $green
|
* @param int $green
|
||||||
* @param int $blue
|
* @param int $blue
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function colorize(int $red = 0, int $green = 0, int $blue = 0): self;
|
public function colorize(int $red = 0, int $green = 0, int $blue = 0): self;
|
||||||
|
|
||||||
@@ -312,6 +332,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Mirror the current image horizontally
|
* Mirror the current image horizontally
|
||||||
*
|
*
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function flip(): self;
|
public function flip(): self;
|
||||||
|
|
||||||
@@ -319,6 +340,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Mirror the current image vertically
|
* Mirror the current image vertically
|
||||||
*
|
*
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function flop(): self;
|
public function flop(): self;
|
||||||
|
|
||||||
@@ -327,6 +349,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param int $amount
|
* @param int $amount
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function blur(int $amount = 5): self;
|
public function blur(int $amount = 5): self;
|
||||||
|
|
||||||
@@ -334,6 +357,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* Invert the colors of the current image
|
* Invert the colors of the current image
|
||||||
*
|
*
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function invert(): self;
|
public function invert(): self;
|
||||||
|
|
||||||
@@ -342,6 +366,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param int $size
|
* @param int $size
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function pixelate(int $size): self;
|
public function pixelate(int $size): self;
|
||||||
|
|
||||||
@@ -351,6 +376,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param float $angle
|
* @param float $angle
|
||||||
* @param string $background
|
* @param string $background
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function rotate(float $angle, mixed $background = 'ffffff'): self;
|
public function rotate(float $angle, mixed $background = 'ffffff'): self;
|
||||||
|
|
||||||
@@ -362,6 +388,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param int $y
|
* @param int $y
|
||||||
* @param callable|FontInterface $font
|
* @param callable|FontInterface $font
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function text(string $text, int $x, int $y, callable|FontInterface $font): self;
|
public function text(string $text, int $x, int $y, callable|FontInterface $font): self;
|
||||||
|
|
||||||
@@ -371,6 +398,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param null|int $width
|
* @param null|int $width
|
||||||
* @param null|int $height
|
* @param null|int $height
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function resize(?int $width = null, ?int $height = null): self;
|
public function resize(?int $width = null, ?int $height = null): self;
|
||||||
|
|
||||||
@@ -380,6 +408,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param null|int $width
|
* @param null|int $width
|
||||||
* @param null|int $height
|
* @param null|int $height
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function resizeDown(?int $width = null, ?int $height = null): self;
|
public function resizeDown(?int $width = null, ?int $height = null): self;
|
||||||
|
|
||||||
@@ -389,6 +418,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param null|int $width
|
* @param null|int $width
|
||||||
* @param null|int $height
|
* @param null|int $height
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function scale(?int $width = null, ?int $height = null): self;
|
public function scale(?int $width = null, ?int $height = null): self;
|
||||||
|
|
||||||
@@ -399,6 +429,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param null|int $width
|
* @param null|int $width
|
||||||
* @param null|int $height
|
* @param null|int $height
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function scaleDown(?int $width = null, ?int $height = null): self;
|
public function scaleDown(?int $width = null, ?int $height = null): self;
|
||||||
|
|
||||||
@@ -411,6 +442,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param int $height
|
* @param int $height
|
||||||
* @param string $position
|
* @param string $position
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function cover(int $width, int $height, string $position = 'center'): self;
|
public function cover(int $width, int $height, string $position = 'center'): self;
|
||||||
|
|
||||||
@@ -421,6 +453,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param int $height
|
* @param int $height
|
||||||
* @param string $position
|
* @param string $position
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function coverDown(int $width, int $height, string $position = 'center'): self;
|
public function coverDown(int $width, int $height, string $position = 'center'): self;
|
||||||
|
|
||||||
@@ -435,6 +468,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param string $position
|
* @param string $position
|
||||||
* @param mixed $background
|
* @param mixed $background
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function resizeCanvas(
|
public function resizeCanvas(
|
||||||
?int $width = null,
|
?int $width = null,
|
||||||
@@ -453,6 +487,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param string $position
|
* @param string $position
|
||||||
* @param mixed $background
|
* @param mixed $background
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function resizeCanvasRelative(
|
public function resizeCanvasRelative(
|
||||||
?int $width = null,
|
?int $width = null,
|
||||||
@@ -475,6 +510,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param string $background
|
* @param string $background
|
||||||
* @param string $position
|
* @param string $position
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function pad(
|
public function pad(
|
||||||
int $width,
|
int $width,
|
||||||
@@ -492,6 +528,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param string $background
|
* @param string $background
|
||||||
* @param string $position
|
* @param string $position
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function contain(
|
public function contain(
|
||||||
int $width,
|
int $width,
|
||||||
@@ -512,6 +549,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param mixed $background
|
* @param mixed $background
|
||||||
* @param string $position
|
* @param string $position
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function crop(
|
public function crop(
|
||||||
int $width,
|
int $width,
|
||||||
@@ -531,6 +569,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param int $offset_y
|
* @param int $offset_y
|
||||||
* @param int $opacity
|
* @param int $opacity
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function place(
|
public function place(
|
||||||
mixed $element,
|
mixed $element,
|
||||||
@@ -554,6 +593,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param null|int $x
|
* @param null|int $x
|
||||||
* @param null|int $y
|
* @param null|int $y
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function fill(mixed $color, ?int $x = null, ?int $y = null): self;
|
public function fill(mixed $color, ?int $x = null, ?int $y = null): self;
|
||||||
|
|
||||||
@@ -564,6 +604,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param int $y
|
* @param int $y
|
||||||
* @param mixed $color
|
* @param mixed $color
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function drawPixel(int $x, int $y, mixed $color): self;
|
public function drawPixel(int $x, int $y, mixed $color): self;
|
||||||
|
|
||||||
@@ -574,6 +615,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param int $y
|
* @param int $y
|
||||||
* @param callable $init
|
* @param callable $init
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function drawRectangle(int $x, int $y, callable $init): self;
|
public function drawRectangle(int $x, int $y, callable $init): self;
|
||||||
|
|
||||||
@@ -584,6 +626,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param int $y
|
* @param int $y
|
||||||
* @param callable $init
|
* @param callable $init
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function drawEllipse(int $x, int $y, callable $init): self;
|
public function drawEllipse(int $x, int $y, callable $init): self;
|
||||||
|
|
||||||
@@ -594,6 +637,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
* @param int $y
|
* @param int $y
|
||||||
* @param callable $init
|
* @param callable $init
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function drawCircle(int $x, int $y, callable $init): self;
|
public function drawCircle(int $x, int $y, callable $init): self;
|
||||||
|
|
||||||
@@ -602,6 +646,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param callable $init
|
* @param callable $init
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function drawPolygon(callable $init): self;
|
public function drawPolygon(callable $init): self;
|
||||||
|
|
||||||
@@ -610,6 +655,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param callable $init
|
* @param callable $init
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function drawLine(callable $init): self;
|
public function drawLine(callable $init): self;
|
||||||
|
|
||||||
@@ -619,6 +665,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param null|string $type
|
* @param null|string $type
|
||||||
* @return EncodedImageInterface
|
* @return EncodedImageInterface
|
||||||
|
* @throws EncoderException
|
||||||
*/
|
*/
|
||||||
public function encodeByMediaType(?string $type = null, ...$options): EncodedImageInterface;
|
public function encodeByMediaType(?string $type = null, ...$options): EncodedImageInterface;
|
||||||
|
|
||||||
@@ -629,6 +676,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param null|string $extension
|
* @param null|string $extension
|
||||||
* @return EncodedImageInterface
|
* @return EncodedImageInterface
|
||||||
|
* @throws EncoderException
|
||||||
*/
|
*/
|
||||||
public function encodeByExtension(?string $extension = null, mixed ...$options): EncodedImageInterface;
|
public function encodeByExtension(?string $extension = null, mixed ...$options): EncodedImageInterface;
|
||||||
|
|
||||||
@@ -639,6 +687,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param null|string $path
|
* @param null|string $path
|
||||||
* @return EncodedImageInterface
|
* @return EncodedImageInterface
|
||||||
|
* @throws EncoderException
|
||||||
*/
|
*/
|
||||||
public function encodeByPath(?string $path = null, mixed ...$options): EncodedImageInterface;
|
public function encodeByPath(?string $path = null, mixed ...$options): EncodedImageInterface;
|
||||||
|
|
||||||
@@ -647,6 +696,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
* @return EncodedImageInterface
|
* @return EncodedImageInterface
|
||||||
|
* @throws EncoderException
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function toJpeg(mixed ...$options): EncodedImageInterface;
|
public function toJpeg(mixed ...$options): EncodedImageInterface;
|
||||||
@@ -656,6 +706,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
* @return EncodedImageInterface
|
* @return EncodedImageInterface
|
||||||
|
* @throws EncoderException
|
||||||
*/
|
*/
|
||||||
public function toJpeg2000(mixed ...$options): EncodedImageInterface;
|
public function toJpeg2000(mixed ...$options): EncodedImageInterface;
|
||||||
|
|
||||||
@@ -664,6 +715,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
* @return EncodedImageInterface
|
* @return EncodedImageInterface
|
||||||
|
* @throws EncoderException
|
||||||
*/
|
*/
|
||||||
public function toWebp(mixed ...$options): EncodedImageInterface;
|
public function toWebp(mixed ...$options): EncodedImageInterface;
|
||||||
|
|
||||||
@@ -672,6 +724,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
* @return EncodedImageInterface
|
* @return EncodedImageInterface
|
||||||
|
* @throws EncoderException
|
||||||
*/
|
*/
|
||||||
public function toPng(mixed ...$options): EncodedImageInterface;
|
public function toPng(mixed ...$options): EncodedImageInterface;
|
||||||
|
|
||||||
@@ -680,6 +733,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
* @return EncodedImageInterface
|
* @return EncodedImageInterface
|
||||||
|
* @throws EncoderException
|
||||||
*/
|
*/
|
||||||
public function toGif(mixed ...$options): EncodedImageInterface;
|
public function toGif(mixed ...$options): EncodedImageInterface;
|
||||||
|
|
||||||
@@ -688,6 +742,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
* @return EncodedImageInterface
|
* @return EncodedImageInterface
|
||||||
|
* @throws EncoderException
|
||||||
*/
|
*/
|
||||||
public function toBitmap(mixed ...$options): EncodedImageInterface;
|
public function toBitmap(mixed ...$options): EncodedImageInterface;
|
||||||
|
|
||||||
@@ -696,6 +751,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
* @return EncodedImageInterface
|
* @return EncodedImageInterface
|
||||||
|
* @throws EncoderException
|
||||||
*/
|
*/
|
||||||
public function toAvif(mixed ...$options): EncodedImageInterface;
|
public function toAvif(mixed ...$options): EncodedImageInterface;
|
||||||
|
|
||||||
@@ -704,6 +760,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
* @return EncodedImageInterface
|
* @return EncodedImageInterface
|
||||||
|
* @throws EncoderException
|
||||||
*/
|
*/
|
||||||
public function toTiff(mixed ...$options): EncodedImageInterface;
|
public function toTiff(mixed ...$options): EncodedImageInterface;
|
||||||
|
|
||||||
@@ -712,6 +769,7 @@ interface ImageInterface extends IteratorAggregate, Countable
|
|||||||
*
|
*
|
||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
* @return EncodedImageInterface
|
* @return EncodedImageInterface
|
||||||
|
* @throws EncoderException
|
||||||
*/
|
*/
|
||||||
public function toHeic(mixed ...$options): EncodedImageInterface;
|
public function toHeic(mixed ...$options): EncodedImageInterface;
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Interfaces;
|
namespace Intervention\Image\Interfaces;
|
||||||
|
|
||||||
|
use Intervention\Image\Exceptions\DecoderException;
|
||||||
|
|
||||||
interface InputHandlerInterface
|
interface InputHandlerInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -11,6 +13,7 @@ interface InputHandlerInterface
|
|||||||
*
|
*
|
||||||
* @param mixed $input
|
* @param mixed $input
|
||||||
* @return ImageInterface|ColorInterface
|
* @return ImageInterface|ColorInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function handle($input): ImageInterface|ColorInterface;
|
public function handle($input): ImageInterface|ColorInterface;
|
||||||
}
|
}
|
||||||
|
@@ -4,6 +4,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Intervention\Image\Interfaces;
|
namespace Intervention\Image\Interfaces;
|
||||||
|
|
||||||
|
use Intervention\Image\Exceptions\DecoderException;
|
||||||
|
|
||||||
interface ModifierInterface
|
interface ModifierInterface
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -11,6 +13,7 @@ interface ModifierInterface
|
|||||||
*
|
*
|
||||||
* @param ImageInterface $image
|
* @param ImageInterface $image
|
||||||
* @return ImageInterface
|
* @return ImageInterface
|
||||||
|
* @throws DecoderException
|
||||||
*/
|
*/
|
||||||
public function apply(ImageInterface $image): ImageInterface;
|
public function apply(ImageInterface $image): ImageInterface;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user