mirror of
https://github.com/Intervention/image.git
synced 2025-08-26 15:24:37 +02:00
Add exception in SliceAnimationModifier
Added again to avoid cryptic error messages.
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
namespace Intervention\Image\Drivers\Gd\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
use Intervention\Image\Drivers\DriverSpecialized;
|
||||||
|
use Intervention\Image\Exceptions\AnimationException;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Interfaces\ModifierInterface;
|
||||||
|
|
||||||
@@ -16,6 +17,10 @@ class SliceAnimationModifier extends DriverSpecialized implements ModifierInterf
|
|||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
if ($this->offset >= $image->count()) {
|
||||||
|
throw new AnimationException('Offset is not in the range of frames.');
|
||||||
|
}
|
||||||
|
|
||||||
$image->core()->slice($this->offset, $this->length);
|
$image->core()->slice($this->offset, $this->length);
|
||||||
|
|
||||||
return $image;
|
return $image;
|
||||||
|
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace Intervention\Image\Drivers\Imagick\Modifiers;
|
namespace Intervention\Image\Drivers\Imagick\Modifiers;
|
||||||
|
|
||||||
use Intervention\Image\Drivers\DriverSpecialized;
|
use Intervention\Image\Drivers\DriverSpecialized;
|
||||||
|
use Intervention\Image\Exceptions\AnimationException;
|
||||||
use Intervention\Image\Interfaces\ImageInterface;
|
use Intervention\Image\Interfaces\ImageInterface;
|
||||||
use Intervention\Image\Interfaces\ModifierInterface;
|
use Intervention\Image\Interfaces\ModifierInterface;
|
||||||
|
|
||||||
@@ -16,6 +17,10 @@ class SliceAnimationModifier extends DriverSpecialized implements ModifierInterf
|
|||||||
{
|
{
|
||||||
public function apply(ImageInterface $image): ImageInterface
|
public function apply(ImageInterface $image): ImageInterface
|
||||||
{
|
{
|
||||||
|
if ($this->offset >= $image->count()) {
|
||||||
|
throw new AnimationException('Offset is not in the range of frames.');
|
||||||
|
}
|
||||||
|
|
||||||
$image->core()->slice($this->offset, $this->length);
|
$image->core()->slice($this->offset, $this->length);
|
||||||
|
|
||||||
return $image;
|
return $image;
|
||||||
|
Reference in New Issue
Block a user