mirror of
https://github.com/Intervention/image.git
synced 2025-08-26 07:14:31 +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;
|
||||
|
||||
use Intervention\Image\Drivers\DriverSpecialized;
|
||||
use Intervention\Image\Exceptions\AnimationException;
|
||||
use Intervention\Image\Interfaces\ImageInterface;
|
||||
use Intervention\Image\Interfaces\ModifierInterface;
|
||||
|
||||
@@ -16,6 +17,10 @@ class SliceAnimationModifier extends DriverSpecialized implements ModifierInterf
|
||||
{
|
||||
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);
|
||||
|
||||
return $image;
|
||||
|
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace Intervention\Image\Drivers\Imagick\Modifiers;
|
||||
|
||||
use Intervention\Image\Drivers\DriverSpecialized;
|
||||
use Intervention\Image\Exceptions\AnimationException;
|
||||
use Intervention\Image\Interfaces\ImageInterface;
|
||||
use Intervention\Image\Interfaces\ModifierInterface;
|
||||
|
||||
@@ -16,6 +17,10 @@ class SliceAnimationModifier extends DriverSpecialized implements ModifierInterf
|
||||
{
|
||||
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);
|
||||
|
||||
return $image;
|
||||
|
Reference in New Issue
Block a user