public class ImagingComponent extends DefaultComponent implements ImagingService
Modifier and Type | Field and Description |
---|---|
static String |
CONFIGURATION_PARAMETERS_EP |
static String |
PICTURE_CONVERSIONS_EP |
Constructor and Description |
---|
ImagingComponent() |
Modifier and Type | Method and Description |
---|---|
void |
activate(ComponentContext context)
Activates the component.
|
PictureView |
computeViewFor(Blob blob,
PictureConversion pictureConversion,
boolean convert)
|
PictureView |
computeViewFor(Blob blob,
PictureConversion pictureConversion,
ImageInfo imageInfo,
boolean convert)
|
List<PictureView> |
computeViewsFor(Blob blob,
List<PictureConversion> pictureConversions,
boolean convert)
|
List<PictureView> |
computeViewsFor(Blob blob,
List<PictureConversion> pictureConversions,
ImageInfo imageInfo,
boolean convert)
|
List<PictureView> |
computeViewsFor(DocumentModel doc,
Blob blob,
ImageInfo imageInfo,
boolean convert)
Compute all the registered
PictureConversion For each picture template the
ImagingService.computeViewFor(Blob, PictureConversion, ImageInfo, boolean) method is call |
List<List<PictureView>> |
computeViewsFor(List<Blob> blobs,
List<PictureConversion> pictureConversions,
boolean convert)
|
List<List<PictureView>> |
computeViewsFor(List<Blob> blobs,
List<PictureConversion> pictureConversions,
ImageInfo imageInfo,
boolean convert)
|
Blob |
crop(Blob blob,
int x,
int y,
int width,
int height)
Crops an image.
|
void |
deactivate(ComponentContext context)
Deactivates the component.
|
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)
|
Map<String,Object> |
getImageMetadata(Blob blob)
Retrieves metadata from an image contained in a
Blob . |
String |
getImageMimeType(Blob blob)
Returns the mime-type for the given Blob
|
String |
getImageMimeType(File file)
Returns the mime-type for the given file.
|
PictureConversion |
getPictureConversion(String id)
Returns a
PictureConversion given its id . |
List<PictureConversion> |
getPictureConversions()
Returns the registered picture conversions.
|
void |
registerContribution(Object contribution,
String extensionPoint,
ComponentInstance contributor) |
Blob |
resize(Blob blob,
String finalFormat,
int width,
int height,
int depth)
Resizes image.
|
Blob |
rotate(Blob blob,
int angle)
Rotates an image.
|
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) |
applicationStarted, getAdapter, getApplicationStartedOrder, getLastModified, registerExtension, setLastModified, unregisterExtension
public static final String CONFIGURATION_PARAMETERS_EP
public static final String PICTURE_CONVERSIONS_EP
public List<PictureConversion> getPictureConversions()
ImagingService
getPictureConversions
in interface ImagingService
public PictureConversion getPictureConversion(String id)
ImagingService
PictureConversion
given its id
.getPictureConversion
in interface ImagingService
public Blob crop(Blob blob, int x, int y, int width, int height)
ImagingService
crop
in interface ImagingService
public Blob resize(Blob blob, String finalFormat, int width, int height, int depth)
ImagingService
resize
in interface ImagingService
public Blob rotate(Blob blob, int angle)
ImagingService
rotate
in interface ImagingService
blob
- a Blob containing the imageangle
- the angle of the rotationpublic Map<String,Object> getImageMetadata(Blob blob)
ImagingService
Blob
.getImageMetadata
in interface ImagingService
public String getImageMimeType(File file)
ImagingService
getImageMimeType
in interface ImagingService
public String getImageMimeType(Blob blob)
ImagingService
getImageMimeType
in interface ImagingService
public ImageInfo getImageInfo(Blob blob)
ImagingService
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).
getImageInfo
in interface ImagingService
blob
- the blob of a pictureImageInfo
of a blobpublic void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
registerContribution
in class DefaultComponent
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor)
unregisterContribution
in class DefaultComponent
public String getConfigurationValue(String configurationName)
ImagingService
getConfigurationValue
in interface ImagingService
configurationName
- the name of the configurationpublic String getConfigurationValue(String configurationName, String defaultValue)
ImagingService
getConfigurationValue
in interface ImagingService
configurationName
- the name of the configurationdefaultValue
- the value of the configurationpublic void setConfigurationValue(String configurationName, String configurationValue)
ImagingService
setConfigurationValue
in interface ImagingService
configurationName
- the name of the configurationconfigurationValue
- the value of the configurationpublic PictureView computeViewFor(Blob blob, PictureConversion pictureConversion, boolean convert) throws IOException, ClientException
ImagingService
computeViewFor
in interface ImagingService
convert
- true if the blob
is converted to fit the pictureConversion
, false if the
blob
is put as it in the PictureView (without any conversion)IOException
ClientException
public PictureView computeViewFor(Blob blob, PictureConversion pictureConversion, ImageInfo imageInfo, boolean convert) throws IOException, ClientException
ImagingService
computeViewFor
in interface ImagingService
imageInfo
- the ImageInfo
to use when computing the viewconvert
- true if the blob
is converted to fit the pictureConversion
, false if the
blob
is put as it in the PictureView (without any conversion)IOException
ClientException
public List<PictureView> computeViewsFor(Blob blob, List<PictureConversion> pictureConversions, boolean convert) throws IOException, ClientException
ImagingService
computeViewsFor
in interface ImagingService
convert
- true if the blob
is converted to fit each PictureConversion
, false if the
blob
is put as it in the PictureView (without any conversion)PictureView
sIOException
ClientException
public List<PictureView> computeViewsFor(Blob blob, List<PictureConversion> pictureConversions, ImageInfo imageInfo, boolean convert) throws IOException, ClientException
ImagingService
computeViewsFor
in interface ImagingService
imageInfo
- the ImageInfo
to use when computing the viewconvert
- true if the blob
is converted to fit each PictureConversion
, false if the
blob
is put as it in the PictureView (without any conversion)PictureView
sIOException
ClientException
public List<PictureView> computeViewsFor(DocumentModel doc, Blob blob, ImageInfo imageInfo, boolean convert) throws ClientException, IOException
ImagingService
PictureConversion
For each picture template the
ImagingService.computeViewFor(Blob, PictureConversion, ImageInfo, boolean)
method is callcomputeViewsFor
in interface ImagingService
ClientException
IOException
public List<List<PictureView>> computeViewsFor(List<Blob> blobs, List<PictureConversion> pictureConversions, boolean convert) throws IOException, ClientException
ImagingService
computeViewsFor
in interface ImagingService
convert
- true if the blob
is converted to fit each PictureConversion
, false if the
blob
is put as it in the PictureView (without any conversion)IOException
ClientException
public List<List<PictureView>> computeViewsFor(List<Blob> blobs, List<PictureConversion> pictureConversions, ImageInfo imageInfo, boolean convert) throws IOException, ClientException
ImagingService
computeViewsFor
in interface ImagingService
imageInfo
- the ImageInfo
to use when computing the viewconvert
- true if the blob
is converted to fit each PictureConversion
, false if the
blob
is put as it in the PictureView (without any conversion)IOException
ClientException
public void activate(ComponentContext context)
Component
This method is called by the runtime when a component is activated.
activate
in interface Component
activate
in class DefaultComponent
context
- the runtime contextpublic void deactivate(ComponentContext context)
Component
This method is called by the runtime when a component is deactivated.
deactivate
in interface Component
deactivate
in class DefaultComponent
context
- the runtime contextCopyright © 2015 Nuxeo SA. All rights reserved.