1616use wcf \system \file \processor \FileProcessor ;
1717use wcf \system \file \processor \FileProcessorPreflightResult ;
1818use wcf \util \JSON ;
19+ use WoltLab \WebpExif \Chunk \Exif ;
1920
2021/**
2122 * Prepares the upload of a file.
@@ -75,6 +76,11 @@ private function createTemporaryFile(PostUploadParameters $parameters, int $numb
7576 $ identifier = \bin2hex (\random_bytes (20 ));
7677 $ objectType = FileProcessor::getInstance ()->getObjectType ($ parameters ->objectType );
7778
79+ $ exifData = $ this ->parseExifData ($ parameters ->exifData );
80+ if ($ exifData !== null ) {
81+ $ exifData = JSON ::encode ($ exifData );
82+ }
83+
7884 $ action = new FileTemporaryAction ([], 'create ' , [
7985 'data ' => [
8086 'identifier ' => $ identifier ,
@@ -85,12 +91,23 @@ private function createTemporaryFile(PostUploadParameters $parameters, int $numb
8591 'objectTypeID ' => $ objectType ?->objectTypeID,
8692 'context ' => $ parameters ->context ,
8793 'chunks ' => \str_repeat ('0 ' , $ numberOfChunks ),
88- 'exifData ' => $ parameters -> exifData ,
94+ 'exifData ' => $ exifData ,
8995 ],
9096 ]);
9197
9298 return $ action ->executeAction ()['returnValues ' ];
9399 }
100+
101+ private function parseExifData (?string $ exifData ): array |null
102+ {
103+ if ($ exifData === null ) {
104+ return null ;
105+ }
106+
107+ $ exif = new Exif (0 , $ exifData );
108+
109+ return $ exif ->getParsedExif ();
110+ }
94111}
95112
96113/** @internal */
0 commit comments