1313use Carbon \Exceptions \InvalidTimeZoneException ;
1414use Illuminate \Support \Carbon ;
1515use PHPExif \Adapter \NoAdapterException ;
16+ use PHPExif \Enum \ReaderType ;
1617use PHPExif \Exif ;
1718use PHPExif \Reader \Reader ;
1819use Safe \Exceptions \StringsException ;
@@ -77,10 +78,10 @@ public static function createFromFile(NativeLocalFile $file): self
7778 // 3. Imagick (not for videos, i.e. for supported photos and accepted raw files only)
7879 // 4. Native PHP exif reader (last resort)
7980 $ reader = match (true ) {
80- (Configs::hasFFmpeg () && $ isSupportedVideo ) => Reader::factory (Reader:: TYPE_FFPROBE ),
81- Configs::hasExiftool () => Reader::factory (Reader:: TYPE_EXIFTOOL ),
82- (Configs::hasImagick () && !$ isSupportedVideo ) => Reader::factory (Reader:: TYPE_IMAGICK ),
83- default => Reader::factory (Reader:: TYPE_NATIVE ),
81+ (Configs::hasFFmpeg () && $ isSupportedVideo ) => Reader::factory (ReaderType:: FFPROBE ),
82+ Configs::hasExiftool () => Reader::factory (ReaderType:: EXIFTOOL ),
83+ (Configs::hasImagick () && !$ isSupportedVideo ) => Reader::factory (ReaderType:: IMAGICK ),
84+ default => Reader::factory (ReaderType:: NATIVE ),
8485 };
8586
8687 // this can throw an exception in the case of Exiftool adapter!
@@ -108,7 +109,7 @@ public static function createFromFile(NativeLocalFile $file): self
108109 try {
109110 Logs::notice (__METHOD__ , __LINE__ , 'Falling back to native adapter. ' );
110111 // Use Php native tools
111- $ reader = Reader::factory (Reader:: TYPE_NATIVE );
112+ $ reader = Reader::factory (ReaderType:: NATIVE );
112113 $ exif = $ reader ->read ($ file ->getRealPath ());
113114 } catch (\InvalidArgumentException |NoAdapterException $ e ) {
114115 throw new ExternalComponentMissingException ('The configured EXIF adapter is not available ' , $ e );
@@ -132,7 +133,7 @@ public static function createFromFile(NativeLocalFile $file): self
132133 if (Configs::hasExiftool () && $ sidecarFile ->exists ()) {
133134 try {
134135 // Don't use the same reader as the file in case it's a video
135- $ sidecarReader = Reader::factory (Reader:: TYPE_EXIFTOOL );
136+ $ sidecarReader = Reader::factory (ReaderType:: EXIFTOOL );
136137 $ sideCarExifData = $ sidecarReader ->read ($ sidecarFile ->getRealPath ());
137138 if (!$ sideCarExifData instanceof Exif) {
138139 throw new MediaFileOperationException ('Could not even extract EXIF data with the exiftool adapter ' );
0 commit comments