<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Image Preview for new Mimetype in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/image-preview-for-new-mimetype/m-p/316664#M3665</link>
    <description>&lt;P&gt;I'm trying to define a new mimetype and enable an associated image preview for it.&lt;/P&gt;
&lt;P&gt;I've defined extensions:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt; - mimetype
 - command for convert
 - convert to JPEG and PNG
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;But the ImagingComponent.getImageInfo(Blob blob) then calls:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;imageInfo = ImageIdentifier.getInfo(file.getAbsolutePath());
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;My guess is that there may be something not defined correctly with the converter.&lt;/P&gt;
&lt;P&gt;But stepping back, it seems to be getting into ImagingComponent from the method org.nuxeo.ecm.platform.preview.adapter.base.ConverterBasedHtmlPreviewAdapter.getPreviewBlobs&lt;/P&gt;
&lt;P&gt;There it determines that the MimeTypePreviewer should be the TiledImagePreviewer.&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;&lt;STRONG&gt;Edit&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;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:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;previewer class="org.nuxeo.ecm.platform.preview.adapter.ImagePreviewer"&amp;gt;
    &amp;lt;pattern&amp;gt;image.*&amp;lt;/pattern&amp;gt;
  &amp;lt;/previewer&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;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?&lt;/P&gt;</description>
    <pubDate>Sat, 30 Aug 2014 21:54:03 GMT</pubDate>
    <dc:creator>dweisinger</dc:creator>
    <dc:date>2014-08-30T21:54:03Z</dc:date>
    <item>
      <title>Image Preview for new Mimetype</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/image-preview-for-new-mimetype/m-p/316664#M3665</link>
      <description>&lt;P&gt;I'm trying to define a new mimetype and enable an associated image preview for it.&lt;/P&gt;
&lt;P&gt;I've defined extensions:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt; - mimetype
 - command for convert
 - convert to JPEG and PNG
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;But the ImagingComponent.getImageInfo(Blob blob) then calls:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;imageInfo = ImageIdentifier.getInfo(file.getAbsolutePath());
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;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.&lt;/P&gt;
&lt;P&gt;My guess is that there may be something not defined correctly with the converter.&lt;/P&gt;
&lt;P&gt;But stepping back, it seems to be getting into ImagingComponent from the method org.nuxeo.ecm.platform.preview.adapter.base.ConverterBasedHtmlPreviewAdapter.getPreviewBlobs&lt;/P&gt;
&lt;P&gt;There it determines that the MimeTypePreviewer should be the TiledImagePreviewer.&lt;/P&gt;
&lt;HR /&gt;
&lt;P&gt;&lt;STRONG&gt;Edit&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;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:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;  &amp;lt;previewer class="org.nuxeo.ecm.platform.preview.adapter.ImagePreviewer"&amp;gt;
    &amp;lt;pattern&amp;gt;image.*&amp;lt;/pattern&amp;gt;
  &amp;lt;/previewer&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;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?&lt;/P&gt;</description>
      <pubDate>Sat, 30 Aug 2014 21:54:03 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/image-preview-for-new-mimetype/m-p/316664#M3665</guid>
      <dc:creator>dweisinger</dc:creator>
      <dc:date>2014-08-30T21:54:03Z</dc:date>
    </item>
  </channel>
</rss>

