mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Fix/mnt 18404 image magick fails on windows (#14)
REMO-18404 Environment not being set for ImageMagick The environment required by ImageMagick was not being set. Even though the environment shown by log4j.logger.org.alfresco.util.exec.RuntimeExec=trace indicated that the required variables already existed in the current environment, that does not mean they are passed on to the sub process. In this case they were not being passed on and they were not being set as additional variables required by the sub process. The bug was introduced when Alfresco PDF renderer was added (REPO-2054) to ACS 5.2.1 and ACS 5.2.g. The context file for ImageMagic (imagemagick-transform-context.xml) was used as the basis for Alfresco PDF renderer's context file. Unfortunately the names of the spring beans that provided the Windows and Unix environment variable values were not changed. As a result, ImageMagick was being provided with Alfresco PDF renderer's environment variables. The Alfresco global property img.gslib and environment variable $GS_LIB set using it, are now redundant following the REPO-2054 work so have been removed in this commit. When testing this issue we should test ImageMagick and Alfresco PDF renderer on both Windows and Unix (Linux). I have not dug into why ImageMagick and Alfresco PDF renderer are working on Linux. I'm guessing that the current environment is being passed on unlike Windows.
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -32,3 +32,6 @@ target
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
|
||||
hs_err_pid*
|
||||
alf_data
|
||||
/src/main/resources/alfresco-global.properties
|
||||
/src/main/resources/alfresco/extension/custom-log4j.properties
|
||||
|
@@ -29,7 +29,6 @@
|
||||
#
|
||||
#img.coders=${img.root}/modules/coders
|
||||
#img.config=${img.root}/config
|
||||
#img.gslib=${img.root}/lib
|
||||
|
||||
#
|
||||
# Property to control whether schema updates are performed automatically.
|
||||
|
@@ -20,7 +20,7 @@
|
||||
</entry>
|
||||
</map>
|
||||
</property>
|
||||
<property name="processProperties" ref="#{systemProperties['os.name'].contains('Windows') ? 'processPropertiesWindows' : 'processPropertiesUnix'}" />
|
||||
<property name="processProperties" ref="#{systemProperties['os.name'].contains('Windows') ? 'transformer.worker.subsys.alfresco-pdf-renderer.processPropertiesWindows' : 'transformer.worker.subsys.alfresco-pdf-renderer.processPropertiesUnix'}" />
|
||||
<property name="defaultProperties">
|
||||
<props>
|
||||
<prop key="options"></prop>
|
||||
@@ -47,7 +47,7 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="processPropertiesWindows" class="org.springframework.beans.factory.config.MapFactoryBean">
|
||||
<bean id="transformer.worker.subsys.alfresco-pdf-renderer.processPropertiesWindows" class="org.springframework.beans.factory.config.MapFactoryBean">
|
||||
<property name="sourceMap">
|
||||
<map>
|
||||
<entry key="ALFRESCO-PDF-RENDERER_HOME">
|
||||
@@ -57,7 +57,7 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="processPropertiesUnix" class="org.springframework.beans.factory.config.MapFactoryBean">
|
||||
<bean id="transformer.worker.subsys.alfresco-pdf-renderer.processPropertiesUnix" class="org.springframework.beans.factory.config.MapFactoryBean">
|
||||
<property name="sourceMap">
|
||||
<map>
|
||||
<entry key="ALFRESCO-PDF-RENDERER_HOME">
|
||||
|
@@ -22,7 +22,7 @@
|
||||
</entry>
|
||||
</map>
|
||||
</property>
|
||||
<property name="processProperties" ref="#{systemProperties['os.name'].contains('Windows') ? 'processPropertiesWindows' : 'processPropertiesUnix'}" />
|
||||
<property name="processProperties" ref="#{systemProperties['os.name'].contains('Windows') ? 'transformer.worker.ImageMagick.processPropertiesWindows' : 'transformer.worker.ImageMagick.processPropertiesUnix'}" />
|
||||
<property name="defaultProperties">
|
||||
<props>
|
||||
<prop key="options"></prop>
|
||||
@@ -50,7 +50,7 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="processPropertiesWindows" class="org.springframework.beans.factory.config.MapFactoryBean">
|
||||
<bean id="transformer.worker.ImageMagick.processPropertiesWindows" class="org.springframework.beans.factory.config.MapFactoryBean">
|
||||
<property name="sourceMap">
|
||||
<map>
|
||||
<entry key="MAGICK_HOME">
|
||||
@@ -62,9 +62,6 @@
|
||||
<entry key="MAGICK_CONFIGURE_PATH">
|
||||
<value>${img.config}</value>
|
||||
</entry>
|
||||
<entry key="GS_LIB">
|
||||
<value>${img.gslib}</value>
|
||||
</entry>
|
||||
<entry key="DYLD_FALLBACK_LIBRARY_PATH">
|
||||
<value>${img.dyn}</value>
|
||||
</entry>
|
||||
@@ -75,7 +72,7 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="processPropertiesUnix" class="org.springframework.beans.factory.config.MapFactoryBean">
|
||||
<bean id="transformer.worker.ImageMagick.processPropertiesUnix" class="org.springframework.beans.factory.config.MapFactoryBean">
|
||||
<property name="sourceMap">
|
||||
<map>
|
||||
<entry key="MAGICK_HOME">
|
||||
|
@@ -4,4 +4,3 @@ img.dyn=${img.root}/lib
|
||||
img.exe=${img.root}/bin/convert
|
||||
img.coders=${img.root}/modules/coders
|
||||
img.config=${img.root}/config
|
||||
img.gslib=
|
||||
|
@@ -120,6 +120,18 @@ public class ImageMagickContentTransformerTest extends AbstractContentTransforme
|
||||
}
|
||||
}
|
||||
|
||||
public void testGifToPng() throws Exception
|
||||
{
|
||||
ImageTransformationOptions options = new ImageTransformationOptions();
|
||||
transform(MimetypeMap.MIMETYPE_IMAGE_GIF, MimetypeMap.MIMETYPE_IMAGE_PNG, options);
|
||||
}
|
||||
|
||||
public void testJpegToPng() throws Exception
|
||||
{
|
||||
ImageTransformationOptions options = new ImageTransformationOptions();
|
||||
transform(MimetypeMap.MIMETYPE_IMAGE_JPEG, MimetypeMap.MIMETYPE_IMAGE_PNG, options);
|
||||
}
|
||||
|
||||
public void testPageSourceOptions() throws Exception
|
||||
{
|
||||
// Test empty source options
|
||||
|
Reference in New Issue
Block a user