Nuxeo ECM Projects 5.4.3-SNAPSHOT

org.nuxeo.ecm.platform.picture
Class ImagingComponent

java.lang.Object
  extended by org.nuxeo.runtime.model.DefaultComponent
      extended by org.nuxeo.ecm.platform.picture.ImagingComponent
All Implemented Interfaces:
ImagingService, Adaptable, Component, Extensible

public class ImagingComponent
extends DefaultComponent
implements ImagingService

Author:
Max Stepanov

Field Summary
static String CONFIGURATION_PARAMETERS_EP
           
 
Constructor Summary
ImagingComponent()
           
 
Method Summary
 Blob crop(Blob blob, int x, int y, int width, int height)
          Crops an image.
 InputStream crop(InputStream in, int x, int y, int width, int height)
          Deprecated. 
 String getConfigurationValue(String configurationName)
          Returns the value a configuration which name is received as parameter.
 String getConfigurationValue(String configurationName, String defaultValue)
          Returns the value a configuration which name is received as parameter.
 ImageInfo getImageInfo(Blob blob)
          Retrieves the ImageInfo of the Blob that is received as parameter.
 Map<String,Object> getImageMetadata(Blob blob)
          Retrieves metadata from an image contained in a Blob.
 Map<String,Object> getImageMetadata(File file)
          Deprecated. 
 Map<String,Object> getImageMetadata(InputStream in)
          Deprecated. 
 String getImageMimeType(File file)
          Returns the mime-type for the given file.
 String getImageMimeType(InputStream in)
          Returns the mime-type for the given input stream.
 void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
           
 Blob resize(Blob blob, String finalFormat, int width, int height, int depth)
          Resizes image.
 InputStream resize(InputStream in, int width, int height)
          Deprecated. 
 Blob rotate(Blob blob, int angle)
          Rotates an image.
 InputStream rotate(InputStream in, int angle)
          Deprecated. 
 void setConfigurationValue(String configurationName, String configurationValue)
          Sets the value of a configuration which could be used by the ImagingService.
 void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
           
 
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, applicationStarted, deactivate, getAdapter, registerExtension, unregisterExtension
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIGURATION_PARAMETERS_EP

public static final String CONFIGURATION_PARAMETERS_EP
See Also:
Constant Field Values
Constructor Detail

ImagingComponent

public ImagingComponent()
Method Detail

crop

@Deprecated
public InputStream crop(InputStream in,
                                   int x,
                                   int y,
                                   int width,
                                   int height)
Deprecated. 

Description copied from interface: ImagingService
Crop image.

Specified by:
crop in interface ImagingService
Returns:
resized image file created in temporary folder

resize

@Deprecated
public InputStream resize(InputStream in,
                                     int width,
                                     int height)
Deprecated. 

Description copied from interface: ImagingService
Resize image.

Specified by:
resize in interface ImagingService
Returns:
resized image file created in temporary folder

rotate

@Deprecated
public InputStream rotate(InputStream in,
                                     int angle)
Deprecated. 

Description copied from interface: ImagingService
Rotate image.

Specified by:
rotate in interface ImagingService

crop

public Blob crop(Blob blob,
                 int x,
                 int y,
                 int width,
                 int height)
Description copied from interface: ImagingService
Crops an image.

Specified by:
crop in interface ImagingService

resize

public Blob resize(Blob blob,
                   String finalFormat,
                   int width,
                   int height,
                   int depth)
Description copied from interface: ImagingService
Resizes image.

Specified by:
resize in interface ImagingService

rotate

public Blob rotate(Blob blob,
                   int angle)
Description copied from interface: ImagingService
Rotates an image.

Specified by:
rotate in interface ImagingService
Parameters:
blob - a Blob containing the image
angle - the angle of the rotation
Returns:
a Blob holding the rotated image

getImageMetadata

@Deprecated
public Map<String,Object> getImageMetadata(InputStream in)
Deprecated. 

Description copied from interface: ImagingService
Retrieves metadata from an image.

Specified by:
getImageMetadata in interface ImagingService

getImageMetadata

@Deprecated
public Map<String,Object> getImageMetadata(File file)
Deprecated. 

Description copied from interface: ImagingService
Retrieves metadata from an image.

Specified by:
getImageMetadata in interface ImagingService

getImageMetadata

public Map<String,Object> getImageMetadata(Blob blob)
Description copied from interface: ImagingService
Retrieves metadata from an image contained in a Blob.

Specified by:
getImageMetadata in interface ImagingService
Returns:
the image metadata as a map String -> Object

getImageMimeType

public String getImageMimeType(File file)
Description copied from interface: ImagingService
Returns the mime-type for the given file.

Specified by:
getImageMimeType in interface ImagingService

getImageMimeType

public String getImageMimeType(InputStream in)
Description copied from interface: ImagingService
Returns the mime-type for the given input stream.

Specified by:
getImageMimeType in interface ImagingService

getImageInfo

public ImageInfo getImageInfo(Blob blob)
Description copied from interface: ImagingService
Retrieves the ImageInfo of the Blob that is received as parameter.

The information provided by the ImageInfo, like width, height or format, is obtained using ImageMagick (see http://www.imagemagick.org/script/index.php for more details on ImageMagick).

Specified by:
getImageInfo in interface ImagingService
Parameters:
blob - the blob of a picture
Returns:
the ImageInfo of a blob

registerContribution

public void registerContribution(Object contribution,
                                 String extensionPoint,
                                 ComponentInstance contributor)
                          throws Exception
Overrides:
registerContribution in class DefaultComponent
Throws:
Exception

unregisterContribution

public void unregisterContribution(Object contribution,
                                   String extensionPoint,
                                   ComponentInstance contributor)
                            throws Exception
Overrides:
unregisterContribution in class DefaultComponent
Throws:
Exception

getConfigurationValue

public String getConfigurationValue(String configurationName)
Description copied from interface: ImagingService
Returns the value a configuration which name is received as parameter.

Specified by:
getConfigurationValue in interface ImagingService
Parameters:
configurationName - the name of the configuration
Returns:
the value of the configuration, which can be null in case no configuration with the specified name was registered

getConfigurationValue

public String getConfigurationValue(String configurationName,
                                    String defaultValue)
Description copied from interface: ImagingService
Returns the value a configuration which name is received as parameter. In case no configuration with the specified name was registered, the received defaultValue parameter will be returned.

Specified by:
getConfigurationValue in interface ImagingService
Parameters:
configurationName - the name of the configuration
defaultValue - the value of the configuration

setConfigurationValue

public void setConfigurationValue(String configurationName,
                                  String configurationValue)
Description copied from interface: ImagingService
Sets the value of a configuration which could be used by the ImagingService.

Specified by:
setConfigurationValue in interface ImagingService
Parameters:
configurationName - the name of the configuration
configurationValue - the value of the configuration

Nuxeo ECM Projects 5.4.3-SNAPSHOT

Copyright © 2011 Nuxeo SAS. All Rights Reserved.