The problem is that on Windows in Alfresco Enterprise 3.2r, this feature broke. On upload of a document, Alfresco tries to generate the thumbnail for the image content, but fails and instead creates a zero-byte thumbnail file.
You'll see something like this.
The default picture of a pair of gears displays whenever Share doesn't have a valid thumbnail file to display.
Searching in the forums for a possible solution, I came across one posted by Nicola Prando. The bug and solution are also posted as ALF-1978. Thanks Nicola!
The trick to fix this is to define a base directory for ImageMagick to use on Windows. You can find the following file:
C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco\subsystems\thirdparty\default\imagemagick-transform-context.xml
You need to add the following lines to the property processProperties for the bean transformer.ImageMagick.Command:
<entry key="SYSTEMROOT"> <value>C:/WINDOWS</value> </entry>
But it isn't good practice to modify a file in the core Alfresco directory. Instead define a new imagemagick-transform-context.xml file and place here:
C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco\extension\imagemagick-transform-context.xml
The contents of the file with this change looks like:
<?xml version='1.0' encoding='UTF-8'?> <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'> <beans> <bean id="transformer.worker.ImageMagick" class="org.alfresco.repo.content.transform.magick.ImageMagickContentTransformerWorker"> <property name="mimetypeService"> <ref bean="mimetypeService" /> </property> <property name="executer"> <bean name="transformer.ImageMagick.Command" class="org.alfresco.util.exec.RuntimeExec"> <property name="commandsAndArguments"> <map> <entry key=".*"> <list> <value>${img.exe}</value> <value>${source}</value> <value>SPLIT:${options}</value> <value>${target}</value> </list> </entry> </map> </property> <property name="processProperties"> <map> <entry key="MAGICK_HOME"> <value>${img.root}</value> </entry> <entry key="DYLD_LIBRARY_PATH"> <value>${img.dyn}</value> </entry> <entry key="LD_LIBRARY_PATH"> <value>${img.dyn}</value> </entry> <entry key="SYSTEMROOT"> <value>C:/WINDOWS</value> </entry> </map> </property> <property name="defaultProperties"> <props> <prop key="options"></prop> </props> </property> </bean> </property> <property name="checkCommand"> <bean name="transformer.ImageMagick.CheckCommand" class="org.alfresco.util.exec.RuntimeExec"> <property name="commandsAndArguments"> <map> <entry key=".*"> <list> <value>${img.exe}</value> <value>-version</value> </list> </entry> </map> </property> </bean> </property> </bean> </beans>
After doing that, thumbnails will get correctly created.
Another tip, if you should ever need to debug Alfresco thumbnail creation, add the following lines to your log4j file to get debug information:
C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\classes\log4j.properties
log4j.logger.org.alfresco.repo.content.transform=debug
log4j.logger.org.alfresco.repo.thumbnail.ThumbnailServiceImpl=debug