Image Preview for new Mimetype

I'm trying to define a new mimetype and enable an associated image preview for it.

I've defined extensions:

 - mimetype
 - command for convert
 - convert to JPEG and PNG

I've uploaded a file of the new mimetype and then attempted to do a preview. It fails though. In the class org.nuxeo.ecm.platform.picture.ImagingComponent, I can see it creating a File object from the Blob of the file. The blob object contains correct information for the filename, length and mimetype.

But the ImagingComponent.getImageInfo(Blob blob) then calls:

imageInfo = ImageIdentifier.getInfo(file.getAbsolutePath());

and there it attempts to call out to the commandline ImageMagick program “identity” to query the image format, even though it already knows the correct mimetype.

ImageMagick fails with an error “no decode delegate for this image format”. I'm not sure why ImageMagick is involved since it can't render this new file format.

My guess is that there may be something not defined correctly with the converter.

But stepping back, it seems to be getting into ImagingComponent from the method org.nuxeo.ecm.platform.preview.adapter.base.ConverterBasedHtmlPreviewAdapter.getPreviewBlobs

There it determines that the MimeTypePreviewer should be the TiledImagePreviewer.


It seem that the preview may not be working since the new converter I've added is based on a new mimetype that starts with “image/…“. The MimeTypePreviewer that is matched is [preview-adapter-contrib.xml] expects that ImageMagick can handle the Preview:

  <previewer class="org.nuxeo.ecm.platform.preview.adapter.ImagePreviewer">

It looks like I need to define a new MimeTypePreviewer? Is that necessary? Or at least define a new entry that maps to HtmlPreviewer to the new mimetype and also provide a converter to HTML for this mimetype?

0 votes

0 answers