Skip to content

Commit

Permalink
Extract exif data in FilePathImageDecoder::class
Browse files Browse the repository at this point in the history
  • Loading branch information
olivervogel committed Dec 30, 2024
1 parent ceb985c commit cb9b71f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Decoders/FilePathImageDecoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Exception;
use Intervention\Image\Exceptions\DecoderException;
use Intervention\Image\Format;
use Intervention\Image\Interfaces\ColorInterface;
use Intervention\Image\Interfaces\ImageInterface;
use Jcupitt\Vips;
Expand Down Expand Up @@ -34,6 +35,11 @@ public function decode(mixed $input): ImageInterface|ColorInterface
// set file path on origin
$image->origin()->setFilePath($input);

// extract exif data for the appropriate formats
if (in_array($this->vipsMediaType($vipsImage)?->format(), [Format::JPEG, Format::TIFF])) {
$image->setExif($this->extractExifData($input));
}

return $image;
}
}

0 comments on commit cb9b71f

Please sign in to comment.