1
0
mirror of https://github.com/Intervention/image.git synced 2025-08-15 10:23:59 +02:00

Return empty collection if no exif data is set

This commit is contained in:
Oliver Vogel
2023-10-06 16:17:42 +02:00
parent f15a30932c
commit 55807ffed8

View File

@@ -2,10 +2,8 @@
namespace Intervention\Image\Drivers\Abstract; namespace Intervention\Image\Drivers\Abstract;
use Intervention\Gif\Exception\NotReadableException;
use Intervention\Image\Collection; use Intervention\Image\Collection;
use Intervention\Image\EncodedImage; use Intervention\Image\EncodedImage;
use Intervention\Image\Exceptions\NotSupportedException;
use Intervention\Image\Geometry\Circle; use Intervention\Image\Geometry\Circle;
use Intervention\Image\Geometry\Ellipse; use Intervention\Image\Geometry\Ellipse;
use Intervention\Image\Geometry\Line; use Intervention\Image\Geometry\Line;
@@ -20,7 +18,6 @@ use Intervention\Image\Interfaces\SizeInterface;
use Intervention\Image\Traits\CanHandleInput; use Intervention\Image\Traits\CanHandleInput;
use Intervention\Image\Traits\CanResolveDriverClass; use Intervention\Image\Traits\CanResolveDriverClass;
use Intervention\Image\Traits\CanRunCallback; use Intervention\Image\Traits\CanRunCallback;
use ReflectionProperty;
abstract class AbstractImage implements ImageInterface abstract class AbstractImage implements ImageInterface
{ {
@@ -30,8 +27,6 @@ abstract class AbstractImage implements ImageInterface
protected Collection $exif; protected Collection $exif;
public function eachFrame(callable $callback): ImageInterface public function eachFrame(callable $callback): ImageInterface
{ {
foreach ($this as $frame) { foreach ($this as $frame) {
@@ -364,6 +359,10 @@ abstract class AbstractImage implements ImageInterface
public function getExif(?string $query = null): mixed public function getExif(?string $query = null): mixed
{ {
if (!isset($this->exif)) {
return new Collection();
}
return is_null($query) ? $this->exif : $this->exif->get($query); return is_null($query) ? $this->exif : $this->exif->get($query);
} }