[ 
https://issues.apache.org/jira/browse/TIKA-5032?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18138066#comment-18138066
 ] 

ASF GitHub Bot commented on TIKA-5032:
--------------------------------------

dschmidt opened a new pull request, #3530:
URL: https://github.com/apache/tika/pull/3530

   Several zip-based formats carry a ready-made preview image, but Tika either 
has no type for them or only sees a plain zip, so `/unpack/preset/thumbnail` 
has nothing to serve.
   
   ZipParser now asks a small `ZipPreview` table which entry is the preview for 
the container's type and marks that entry as `THUMBNAIL`:
   
   | Format | Type (new) | Preview |
   |---|---|---|
   | Comic book archive `.cbz` | `application/vnd.comicbook+zip` | first image 
in name order (`__MACOSX/` and hidden files skipped) |
   | Krita `.kra` | `application/x-krita` | `preview.png` |
   | OpenRaster `.ora` | `image/openraster` | `Thumbnails/thumbnail.png` |
   | FreeCAD `.FCStd` | `application/x-extension-fcstd` | 
`thumbnails/Thumbnail.png` |
   | Procreate `.procreate` | `application/x-procreate` | 
`QuickLook/Thumbnail.png` |
   
   All five are sub-types of `application/zip` and are added to ZipParser's zip 
specializations so the type is kept. Krita and OpenRaster are already 
identified by their `mimetype` entry through OpenDocumentDetector; the others 
by extension. Because the types are zip sub-types, a file with a colliding 
extension that is not a zip (an Oracle `tnsnames.ora`) keeps its detected type. 
The preview is only picked on the `ZipFile` path: the comic rule needs the 
whole central directory.
   
   Tests build their zips at runtime (no binary fixtures): the cover is picked 
by name regardless of archive order, macOS leftovers and `ComicInfo.xml` are 
ignored, each fixed path is marked, a missing preview marks nothing, and a 
plain `.zip` gets no thumbnail. Also checked by hand against one real file of 
each format: the preset returned exactly the stored preview for all five, and 
204 before.
   
   3MF (`Metadata/thumbnail.png`) can be added once TIKA-5031 makes 3MF a zip 
sub-type. Sketch is left out for lack of a real file carrying 
`previews/preview.png`.
   
   https://issues.apache.org/jira/browse/TIKA-5032
   




> Extract the preview image of zip-based formats (comics, Krita, OpenRaster, 
> Procreate, Sketch, FreeCAD, 3MF)
> -----------------------------------------------------------------------------------------------------------
>
>                 Key: TIKA-5032
>                 URL: https://issues.apache.org/jira/browse/TIKA-5032
>             Project: Tika
>          Issue Type: Improvement
>          Components: mime, parser
>            Reporter: Dominik Schmidt
>            Priority: Major
>
> These formats are zip containers that carry a ready-made preview at a fixed 
> path:
> * {{.cbz}}: first image in name order
> * {{.kra}}: {{preview.png}}
> * {{.ora}}: {{Thumbnails/thumbnail.png}}
> * {{.procreate}}: {{QuickLook/Thumbnail.png}}
> * {{.sketch}}: {{previews/preview.png}}
> * {{.FCStd}}: {{thumbnails/Thumbnail.png}}
> * {{.3mf}}: {{Metadata/thumbnail.png}}
> Detect them and emit that image as the THUMBNAIL embedded resource, so 
> {{/unpack/preset/thumbnail}} serves it. Several have no media type in 
> tika-mimetypes.xml yet (shared-mime-info has 
> {{application/vnd.comicbook+zip}}, {{application/x-krita}}, 
> {{image/openraster}}). For 3MF see TIKA-5031.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to