As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
The out-of-the-box thumbnails are registered in the thumbnail-service-context.xml file. I don’t see a clean way to extend that without repeating the definitions, so in my example, I wrote a bean that calls the Thumbnail Registry and registers the custom thumbnail definitions provided in the Spring context file
Instead of creating a custom bean to register your custom thumbnail definitions, you could have just used MethodInvokingFactory bean to register them directly to the default thumbnailRegistry bean.
document.createThumbnail("scImageThumbnail", true);
<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'> <beans> <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="scImageThumbnail"/> <property name="mimetype" value="image/png"/> <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="100"/> <property name="maintainAspectRatio" value="true"/> <property name="resizeToThumbnail" value="true"/> </bean> </property> </bean> </property> <property name="placeHolderResourcePath" value="alfresco/thumbnail/thumbnail_placeholder_medium.jpg"/> </bean> </list> </property> </bean> </beans>
<!– User avatar 64x64 image thumbnail options –> <!– Note that this will auto-register with parent="baseThumbnailDefinition" in the future –>
<bean id="assetPreview" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> <property name="targetObject" ref="thumbnailRegistry" /> <property name="targetMethod" value="addThumbnailDefinition" /> <property name="arguments"> <list> <!– Asset Preview - thumbnail options –> <bean class="org.alfresco.repo.thumbnail.ThumbnailDefinition"> <property name="name" value="assetPreview" /> <property name="mimetype" value="image/png"/> <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="width" value="600"/> <property name="height" value="600"/> <property name="maintainAspectRatio" value="true"/> <property name="resizeToThumbnail" value="true" /> <property name="allowEnlargement" value="false" /> </bean> </property> </bean> </property> <property name="placeHolderResourcePath" value="alfresco/thumbnail/thumbnail_placeholder_imgpreview.png" /> <property name="runAs" value="System"/> <property name="failureHandlingOptions" ref="standardFailureOptions"/> </bean> </list> </property> </bean>