Class DefaultImageMagickService
- java.lang.Object
-
- de.hybris.platform.mediaconversion.imagemagick.BasicImageMagickStrategy
-
- de.hybris.platform.mediaconversion.imagemagick.DefaultImageMagickService
-
- All Implemented Interfaces:
ImageMagickService
public class DefaultImageMagickService extends BasicImageMagickStrategy implements ImageMagickService
Default implementation of aImageMagickServicebacked by ImageMagick .Both ImageMagick executable (
The behavior of this service can be influenced by the following properties:convertandidentifyin use will be executed by the auto injectedProcessExecutor.Property Meaning Default imagemagick.bindirThe binary directory of your local image magick installation. *imagemagick.executable.convertThe convertexecutable to call.convert imagemagick.executable.identifyThe identifyexecutable to call.identify imagemagick.configuration.directoryPath to the Configuration directory to use. Lookup sequence is as follows: - If the configuration directory was set through spring injection, it will be used (the property value is disobeyed)
- If the property is set, this path will be used.
- If the JVM
MAGICK_CONFIGURE_PATHenvironment variable is set, it will be used. - The embedded configuration directory (see
BasicImageMagickStrategy.EMBEDDED_CONFIG_DIR) will be used.
Note: all environment variables relevant to ImageMagick will be forwarded to the executed process when set in the JVM environment.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCONVERT_EXECExecutable name to be used with theIMAGEMAGICK_EXECUTABLE_KEY_PREFIXconf key prefix.static java.lang.StringDYLD_LIBRARY_PATHstatic java.lang.StringDYLD_LIBRARY_PATH_ENVstatic java.lang.StringEMBEDDED_BIN_DIRDeprecated, for removal: This API element is subject to removal in a future version.: since 6.1 ImageMagick in no longer embedded and has to be installed manually.static java.lang.StringIDENTIFY_EXECExecutable name to be used with theIMAGEMAGICK_EXECUTABLE_KEY_PREFIXconf key prefix.static java.lang.StringIMAGEMAGICK_DIRProperty key for the binary directory to use (overrides build in mechanism).static java.lang.StringIMAGEMAGICK_EXECUTABLE_KEY_PREFIXConfiguration key prefix for the executable name to use.-
Fields inherited from class de.hybris.platform.mediaconversion.imagemagick.BasicImageMagickStrategy
EMBEDDED_CONFIG_DIR, IMAGEMAGICK_CONFIGURATION_DIRECTORY
-
-
Constructor Summary
Constructors Constructor Description DefaultImageMagickService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String[]buildEnvironment(java.io.File executable)Assembling image magick environment.voidconvert(java.util.List<java.lang.String> commandOpts)Executes a conversion with the specified list of options.OsConfigurationServicegetOsConfigurationService()ProcessExecutorgetProcessExecutor()java.lang.Stringidentify(java.util.List<java.lang.String> commandOptions)Executes image identification with the specified options.voidsetOsConfigurationService(OsConfigurationService osDirectoryService)voidsetProcessExecutor(ProcessExecutor processExecutor)voidsetSecurityService(ImageMagickSecurityService securityService)-
Methods inherited from class de.hybris.platform.mediaconversion.imagemagick.BasicImageMagickStrategy
getConfigurationDirectory, getConfigurationService, getTmpDir, setConfigurationDirectory, setConfigurationService, setTmpDir
-
-
-
-
Field Detail
-
EMBEDDED_BIN_DIR
@Deprecated(since="6.1", forRemoval=true) public static final java.lang.String EMBEDDED_BIN_DIRDeprecated, for removal: This API element is subject to removal in a future version.: since 6.1 ImageMagick in no longer embedded and has to be installed manually.Default root of the binary directory (embedded and shipped with this extension). Note that below this directory there is a os.name/os.arch structure for various platforms.- See Also:
- Constant Field Values
-
IMAGEMAGICK_DIR
public static final java.lang.String IMAGEMAGICK_DIR
Property key for the binary directory to use (overrides build in mechanism).- See Also:
- Constant Field Values
-
IMAGEMAGICK_EXECUTABLE_KEY_PREFIX
public static final java.lang.String IMAGEMAGICK_EXECUTABLE_KEY_PREFIX
Configuration key prefix for the executable name to use. Currently it is in use with two ImageMagick executable which are mapped/configuredf to the equal string:- imagemagick.executable.convert -> convert
- imagemagick.executable.identify -> identify
- See Also:
CONVERT_EXEC,IDENTIFY_EXEC, Constant Field Values
-
DYLD_LIBRARY_PATH
public static final java.lang.String DYLD_LIBRARY_PATH
- See Also:
- Constant Field Values
-
DYLD_LIBRARY_PATH_ENV
public static final java.lang.String DYLD_LIBRARY_PATH_ENV
- See Also:
- Constant Field Values
-
CONVERT_EXEC
public static final java.lang.String CONVERT_EXEC
Executable name to be used with theIMAGEMAGICK_EXECUTABLE_KEY_PREFIXconf key prefix. This property key is used to have an indirection if a different executable should be used.- See Also:
- Constant Field Values
-
IDENTIFY_EXEC
public static final java.lang.String IDENTIFY_EXEC
Executable name to be used with theIMAGEMAGICK_EXECUTABLE_KEY_PREFIXconf key prefix. This property key is used to have an indirection if a different executable should be used.- See Also:
- Constant Field Values
-
-
Method Detail
-
buildEnvironment
protected java.lang.String[] buildEnvironment(java.io.File executable) throws java.io.IOExceptionAssembling image magick environment.- Parameters:
executable- the executable to use- Returns:
- environment setting as array of 'key=value' strings
- Throws:
java.io.IOException- See Also:
- Customize ImageMagick With Resources
-
convert
public void convert(java.util.List<java.lang.String> commandOpts) throws java.io.IOExceptionDescription copied from interface:ImageMagickServiceExecutes a conversion with the specified list of options. The options available are numerous and listed on the ImageMagick command line options page.- Specified by:
convertin interfaceImageMagickService- Parameters:
commandOpts- the bold command line options (including input and output files if applicable).- Throws:
java.io.IOException- on any error
-
identify
public java.lang.String identify(java.util.List<java.lang.String> commandOptions) throws java.io.IOExceptionDescription copied from interface:ImageMagickServiceExecutes image identification with the specified options. Please see ImageMagick Identify Command-line Tool for usage and option descriptions.- Specified by:
identifyin interfaceImageMagickService- Parameters:
commandOptions- bold command line options to the identify command (including the input file).- Returns:
- the commands (std) output.
- Throws:
java.io.IOException- on any error.
-
getProcessExecutor
public ProcessExecutor getProcessExecutor()
-
setProcessExecutor
public void setProcessExecutor(ProcessExecutor processExecutor)
-
getOsConfigurationService
public OsConfigurationService getOsConfigurationService()
-
setOsConfigurationService
public void setOsConfigurationService(OsConfigurationService osDirectoryService)
-
setSecurityService
public void setSecurityService(ImageMagickSecurityService securityService)
-
-