ariselseng / camerarawpreviews

Camera Raw Previews app for Nextcloud
GNU Affero General Public License v3.0
53 stars 11 forks source link

Preview of TIFFs without embedded preview #39

Closed d--j closed 4 years ago

d--j commented 4 years ago

This line

https://github.com/ariselseng/camerarawpreviews/blob/0a8268aaddd6445be4f833638b42e834156af30a/lib/AppInfo/Application.php#L64

registers a wrong MIME type for .tif files (no .tiff files, tho) so that your RawPreview class can handle TIFF previews. Currently RawPreview can only handle TIFFs with embedded previews. OC\Preview\TIFF can also preview TIFF files that do not include a preview (like these test-tiffs.zip )

exiftool returns this for the example file:

./exiftool -json -preview:all t/XING_T24.tiff 
[{
  "SourceFile": "t/XING_T24.tiff"
}]

Could you maybe add a check that sees if the Nextcloud instance has OC\Preview\TIFF configured for a preview provider and if that's the case skip the MIME type registration of tif to image/x-dcraw? Alternatively one could probably teach this app to fall back to extracting a preview form the SourceFile TIFF when the imagick PHP extension is present and exiftool does not return a PreviewTIFF key.

see nextcloud/server#12876

ariselseng commented 4 years ago

Well this sucks :) Good spotting the missing "f" in "tiff". Making the mimetypes configurable would also certainly help so people can disable a filetype if needed. I am out of time lately so I am not sure I can fix this right away. A PR is welcome.