AnsweredAssumed Answered

The resizeToThumbnail option is not passed though to the convert command when trying to create thumbnails

Question asked by ianw on Apr 4, 2016
Latest reply on Apr 7, 2016 by ianw
The gallery plus dashlet defines the following bean,


   <!– Thumbnail definition "galpThumb120" for thumbnails with a height of 120 pixels –>
   <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
      <property name="targetObject" ref="thumbnailRegistry" />
      <property name="targetMethod" value="addThumbnailDefinition" />
      <property name="arguments">
         <list>
            <bean class="org.alfresco.repo.thumbnail.ThumbnailDefinition">
               <property name="name" value="galpThumb120" />
               <property name="mimetype" value="image/jpeg" />
               <property name="transformationOptions">
                  <bean
                     class="org.alfresco.repo.content.transform.magick.ImageTransformationOptions">
                     <property name="resizeOptions">
                        <bean
                           class="org.alfresco.repo.content.transform.magick.ImageResizeOptions">
                           <property name="height" value="120" />
                           <property name="width" value="4000" />
                           <property name="maintainAspectRatio" value="true" />
                           <property name="resizeToThumbnail" value="true" />
                        </bean>
                     </property>
                  </bean>
               </property>
               <property name="placeHolderResourcePath"
                  value="alfresco/extension/thumbnail/thumbnail_placeholder_galpThumb120.jpg" />
            </bean>
         </list>
      </property>
   </bean>



however the command to generate the thumbnail is:
<blockquote>
2016-04-04 11:02:46,681  DEBUG [util.exec.RuntimeExec] [pool-14-thread-1] Execution result:
   os:         Linux
   command:    /home/ian/work/ImageMagick/convert /home/ian/work/Gallery_Plus_Dashlet_IPW/gallery_plus-repo/target/Alfresco/ImageMagickContentTransformerWorker_source_7082732122820643958.png[0] -alpha remove -auto-orient -resize 4000x120 /home/ian/work/Gallery_Plus_Dashlet_IPW/gallery_plus-repo/target/Alfresco/ImageMagickContentTransformerWorker_target_8091252949361762254.jpg
   succeeded:  true
   exit code:  0
   out:       
   err:
</blockquote>
Note the -resize which I believe should be -thumbnail.

A little bit of debug shows me that the bean correct values are being passed to addThumbnailDefinition (ThumbnailRegisty.java)
<blockquote>
2016-04-04 11:00:48,693  DEBUG [repo.thumbnail.ThumbnailRegistry] [localhost-startStop-1] ……… - addThumbnailDefinition, name: galpThumb120
2016-04-04 11:00:48,693  DEBUG [repo.thumbnail.ThumbnailRegistry] [localhost-startStop-1] ……… - addThumbnailDefinition, TransformationOptions: ImageTransformationOptions [commandOptions=, resizeOptions=ImageResizeOptions [width=4000, height=120, maintainAspectRatio=true, percentResize=false, resizeToThumbnail=true, allowEnlargement=true], autoOrient=true]]
</blockquote>

but when the values are retrieved in transformInternal (ImageMagickContentTransformWorker.java) the height and width are correct but the resizeToThumbnail value is false when it should be true.

<blockquote>
2016-04-04 11:02:51,384  DEBUG [transform.magick.ImageMagickContentTransformerWorker] [pool-14-thread-1] ……….. - imageOptions: ImageTransformationOptions [commandOptions=, resizeOptions=ImageResizeOptions [width=4000, height=120, maintainAspectRatio=true, percentResize=false, resizeToThumbnail=false, allowEnlargement=true], autoOrient=true], sourceOptions={ PagedSourceOptionsorg.alfresco.service.cmr.repository.PagedSourceOptions@4afd776a} ]
</blockquote>

I'm new to both java and alfresco so the question is: Is this a bug in Alfresco or Am I missing something?

Outcomes