Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composer update - php-exif 0.8 + bump to version 4.7 #1680

Merged
merged 5 commits into from
Jan 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions app/Metadata/Extractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
use Carbon\Exceptions\InvalidTimeZoneException;
use Illuminate\Support\Carbon;
use PHPExif\Adapter\NoAdapterException;
use PHPExif\Enum\ReaderType;
use PHPExif\Exif;
use PHPExif\Reader\Reader;
use Safe\Exceptions\StringsException;
Expand Down Expand Up @@ -77,10 +78,10 @@ public static function createFromFile(NativeLocalFile $file): self
// 3. Imagick (not for videos, i.e. for supported photos and accepted raw files only)
// 4. Native PHP exif reader (last resort)
$reader = match (true) {
(Configs::hasFFmpeg() && $isSupportedVideo) => Reader::factory(Reader::TYPE_FFPROBE),
Configs::hasExiftool() => Reader::factory(Reader::TYPE_EXIFTOOL),
(Configs::hasImagick() && !$isSupportedVideo) => Reader::factory(Reader::TYPE_IMAGICK),
default => Reader::factory(Reader::TYPE_NATIVE),
(Configs::hasFFmpeg() && $isSupportedVideo) => Reader::factory(ReaderType::FFPROBE),
Configs::hasExiftool() => Reader::factory(ReaderType::EXIFTOOL),
(Configs::hasImagick() && !$isSupportedVideo) => Reader::factory(ReaderType::IMAGICK),
default => Reader::factory(ReaderType::NATIVE),
};

// this can throw an exception in the case of Exiftool adapter!
Expand Down Expand Up @@ -108,7 +109,7 @@ public static function createFromFile(NativeLocalFile $file): self
try {
Logs::notice(__METHOD__, __LINE__, 'Falling back to native adapter.');
// Use Php native tools
$reader = Reader::factory(Reader::TYPE_NATIVE);
$reader = Reader::factory(ReaderType::NATIVE);
$exif = $reader->read($file->getRealPath());
} catch (\InvalidArgumentException|NoAdapterException $e) {
throw new ExternalComponentMissingException('The configured EXIF adapter is not available', $e);
Expand All @@ -132,7 +133,7 @@ public static function createFromFile(NativeLocalFile $file): self
if (Configs::hasExiftool() && $sidecarFile->exists()) {
try {
// Don't use the same reader as the file in case it's a video
$sidecarReader = Reader::factory(Reader::TYPE_EXIFTOOL);
$sidecarReader = Reader::factory(ReaderType::EXIFTOOL);
$sideCarExifData = $sidecarReader->read($sidecarFile->getRealPath());
if (!$sideCarExifData instanceof Exif) {
throw new MediaFileOperationException('Could not even extract EXIF data with the exiftool adapter');
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"laravel/framework": "^9.2",
"livewire/livewire": "^2.7",
"lychee-org/nestedset": "^6",
"lychee-org/php-exif": "^0.7.14",
"lychee-org/php-exif": "^0.8",
"maennchen/zipstream-php": "^2.1",
"php-ffmpeg/php-ffmpeg": "^1.0",
"php-http/guzzle7-adapter": "^1.0",
Expand Down
Loading