问题
I have spent the last week developing an upload system where my application could take a camera RAW file, draw out the metadata and then save the file as a jpg.
I use ExifTool to draw out the metadata. I use ImageMagick to convert the file to .jpg.
I am working with 4 file types to begin with CRW, RAF, ARW and NEF.
However, the uploading of different RAW files in the browser results in the different file types being identified in the upload. This was a problem for 2 of the different RAW types:
CRW (Canon): $_FILES['type']: 'image/x-canon-crw'
Behaved as expected. Was able to draw out the metadata and save the file as a .jpg. This is the only one that the browser recognised.
RAF (Fujifilm): $_FILES['type']: 'application/octet-stream'
Behaved as expected. Was able to draw out the metadata and save the file as a .jpg
ARW (Sony): $_FILES['type']: 'application/octet-stream'
Was able to draw out metadata but ImageMagick could not recognise the file and save it as a .jpg. ImageMagik responds with
"magick: Unknown field with tag 50341 (0xc4a5) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/1037."
So it appears ImageMagick is treating it as a TIFF?
NEF (Nikon): $_FILES['type']: 'application/octet-stream'
was able to draw out metadata but image Magick would unexpectedly save the jpg with the thumbnail rather than the image uploaded (I have no idea why!) ImageMagick responds with
"magick: Unknown field with tag 36867 (0x9003) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/1037."
This appears to be another TIFF issue. No idea why?
The code controlling the ImageMagick conversion does not change between RAW types.
I can work with the Canon and Fujifilm files but not with the Sony or Nikon and I cannot figure out why. How do fix this TIFF issue?
Does anyone else have any experience with this?
来源:https://stackoverflow.com/questions/62437376/uploading-of-camera-raw-files-to-a-web-server-file-type-issue-is-there-a-work