org.alfresco.repo.content.transform.magick
Class ImageMagickContentTransformer

java.lang.Object
  extended by org.alfresco.repo.content.transform.AbstractContentTransformer2
      extended by org.alfresco.repo.content.transform.magick.AbstractImageMagickContentTransformer
          extended by org.alfresco.repo.content.transform.magick.ImageMagickContentTransformer
All Implemented Interfaces:
ContentWorker, ContentTransformer

public class ImageMagickContentTransformer
extends AbstractImageMagickContentTransformer

Executes a statement to implement


Field Summary
 
Fields inherited from class org.alfresco.repo.content.transform.magick.AbstractImageMagickContentTransformer
MIMETYPE_IMAGE_PREFIX
 
Constructor Summary
ImageMagickContentTransformer()
          Default constructor
 
Method Summary
 void init()
          Checks for the JMagick and ImageMagick dependencies, using the common transformation method to check that the sample image can be converted.
 void setExecuter(org.alfresco.util.exec.RuntimeExec executer)
          Set the runtime command executer that must be executed in order to run ImageMagick.
protected  void transformInternal(java.io.File sourceFile, java.io.File targetFile, TransformationOptions options)
          Transform the image content from the source file to the target file
 
Methods inherited from class org.alfresco.repo.content.transform.magick.AbstractImageMagickContentTransformer
isAvailable, isSupported, isTransformable, setAvailable, transformInternal
 
Methods inherited from class org.alfresco.repo.content.transform.AbstractContentTransformer2
checkTransformable, getMimetype, getMimetypeService, getTransformationTime, isExplicitTransformation, recordTime, register, setExplicitTransformations, setMimetypeService, setRegistry, toString, transform, transform, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ImageMagickContentTransformer

public ImageMagickContentTransformer()
Default constructor

Method Detail

setExecuter

public void setExecuter(org.alfresco.util.exec.RuntimeExec executer)
Set the runtime command executer that must be executed in order to run ImageMagick. Whether or not this is the full path to the convertCommand or just the convertCommand itself depends the environment setup.

The command must contain the variables ${source} and ${target}, which will be replaced by the names of the file to be transformed and the name of the output file respectively.

    convert ${source} ${target}
 

Parameters:
executer - the system command executer

init

public void init()
Checks for the JMagick and ImageMagick dependencies, using the common transformation method to check that the sample image can be converted.

Overrides:
init in class AbstractImageMagickContentTransformer

transformInternal

protected void transformInternal(java.io.File sourceFile,
                                 java.io.File targetFile,
                                 TransformationOptions options)
                          throws java.lang.Exception
Transform the image content from the source file to the target file

Specified by:
transformInternal in class AbstractImageMagickContentTransformer
Parameters:
sourceFile - the source of the transformation
targetFile - the target of the transformation
options - the transformation options supported by ImageMagick
Throws:
java.lang.Exception


Copyright © 2005 - 2008 Alfresco Software, Inc. All Rights Reserved.