Package org.nuxeo.ecm.platform.picture
Class ImagingComponent
java.lang.Object
org.nuxeo.runtime.model.DefaultComponent
org.nuxeo.ecm.platform.picture.ImagingComponent
- All Implemented Interfaces:
ImagingService
,Adaptable
,Component
,Extensible
,TimestampedService
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
static final String
protected PictureConversionRegistry
Fields inherited from class org.nuxeo.runtime.model.DefaultComponent
lastModified, name
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected Blob
callPictureConversionChain
(DocumentModel doc, Blob blob, PictureConversion pictureConversion, ImageInfo imageInfo, Point size, String conversionFormat) protected boolean
canApplyPictureConversion
(PictureConversion pictureConversion, DocumentModel doc) protected PictureView
computeView
(Blob blob, PictureConversion pictureConversion, ImageInfo imageInfo, boolean convert) protected PictureView
computeView
(DocumentModel doc, Blob blob, PictureConversion pictureConversion, ImageInfo imageInfo) protected PictureView
computeView
(DocumentModel doc, Blob blob, PictureConversion pictureConversion, ImageInfo imageInfo, boolean convert) computeViewFor
(Blob blob, PictureConversion pictureConversion, boolean convert) computeViewFor
(Blob blob, PictureConversion pictureConversion, ImageInfo imageInfo, boolean convert) computeViewsFor
(List<Blob> blobs, List<PictureConversion> pictureConversions, boolean convert) computeViewsFor
(List<Blob> blobs, List<PictureConversion> pictureConversions, ImageInfo imageInfo, boolean convert) computeViewsFor
(Blob blob, List<PictureConversion> pictureConversions, boolean convert) computeViewsFor
(Blob blob, List<PictureConversion> pictureConversions, ImageInfo imageInfo, boolean convert) computeViewsFor
(DocumentModel doc, Blob blob, ImageInfo imageInfo, boolean convert) Compute all the registeredPictureConversion
For each picture template theImagingService.computeViewFor(Blob, PictureConversion, ImageInfo, boolean)
method is callprotected PictureView
computeViewWithoutConversion
(Blob blob, PictureConversion pictureConversion, ImageInfo imageInfo) convertToPDF
(Blob blob) Converts an image to PDF.protected ActionContext
Crops an image.getConfigurationValue
(String configurationName) Returns the value a configuration which name is received as parameter.getConfigurationValue
(String configurationName, String defaultValue) Returns the value a configuration which name is received as parameter.getImageInfo
(Blob blob) getImageMimeType
(File file) Returns the mime-type for the given file.getImageMimeType
(Blob blob) Returns the mime-type for the given BlobReturns aPictureConversion
given itsid
.Returns the registered picture conversions.protected static Point
Deprecated.void
registerContribution
(Object contribution, String extensionPoint, ComponentInstance contributor) Resizes image.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) protected Blob
Methods inherited from class org.nuxeo.runtime.model.DefaultComponent
activate, addRuntimeMessage, addRuntimeMessage, deactivate, getAdapter, getDescriptor, getDescriptors, getLastModified, getRegistry, register, registerExtension, setLastModified, setModifiedNow, setName, start, stop, unregister, unregisterExtension
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.nuxeo.runtime.model.Component
getApplicationStartedOrder
-
Field Details
-
CONFIGURATION_PARAMETERS_EP
- See Also:
-
PICTURE_CONVERSIONS_EP
- See Also:
-
configurationParameters
-
pictureConversionRegistry
-
-
Constructor Details
-
ImagingComponent
public ImagingComponent()
-
-
Method Details
-
getPictureConversions
Description copied from interface:ImagingService
Returns the registered picture conversions.- Specified by:
getPictureConversions
in interfaceImagingService
-
getPictureConversion
Description copied from interface:ImagingService
Returns aPictureConversion
given itsid
.- Specified by:
getPictureConversion
in interfaceImagingService
-
crop
Description copied from interface:ImagingService
Crops an image.- Specified by:
crop
in interfaceImagingService
-
resize
Description copied from interface:ImagingService
Resizes image.- Specified by:
resize
in interfaceImagingService
-
rotate
Description copied from interface:ImagingService
Rotates an image.- Specified by:
rotate
in interfaceImagingService
- Parameters:
blob
- a Blob containing the imageangle
- the angle of the rotation- Returns:
- a Blob holding the rotated image
-
convertToPDF
Description copied from interface:ImagingService
Converts an image to PDF.- Specified by:
convertToPDF
in interfaceImagingService
- Parameters:
blob
- a Blob containing the image- Returns:
- a Blob holding the resulting PDF
-
getImageMimeType
Description copied from interface:ImagingService
Returns the mime-type for the given file.- Specified by:
getImageMimeType
in interfaceImagingService
-
getImageMimeType
Description copied from interface:ImagingService
Returns the mime-type for the given Blob- Specified by:
getImageMimeType
in interfaceImagingService
-
getImageInfo
Description copied from interface:ImagingService
Retrieves theImageInfo
of theBlob
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 interfaceImagingService
- Parameters:
blob
- the blob of a picture- Returns:
- the
ImageInfo
of a blob
-
registerContribution
public void registerContribution(Object contribution, String extensionPoint, ComponentInstance contributor) - Overrides:
registerContribution
in classDefaultComponent
-
unregisterContribution
public void unregisterContribution(Object contribution, String extensionPoint, ComponentInstance contributor) - Overrides:
unregisterContribution
in classDefaultComponent
-
getConfigurationValue
Description copied from interface:ImagingService
Returns the value a configuration which name is received as parameter.- Specified by:
getConfigurationValue
in interfaceImagingService
- 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
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 interfaceImagingService
- Parameters:
configurationName
- the name of the configurationdefaultValue
- the value of the configuration
-
setConfigurationValue
Description copied from interface:ImagingService
Sets the value of a configuration which could be used by the ImagingService.- Specified by:
setConfigurationValue
in interfaceImagingService
- Parameters:
configurationName
- the name of the configurationconfigurationValue
- the value of the configuration
-
computeViewFor
Description copied from interface:ImagingService
- Specified by:
computeViewFor
in interfaceImagingService
convert
- true if theblob
is converted to fit thepictureConversion
, false if theblob
is put as it in the PictureView (without any conversion)- Returns:
- the computed picture view
-
computeViewFor
public PictureView computeViewFor(Blob blob, PictureConversion pictureConversion, ImageInfo imageInfo, boolean convert) Description copied from interface:ImagingService
- Specified by:
computeViewFor
in interfaceImagingService
imageInfo
- theImageInfo
to use when computing the viewconvert
- true if theblob
is converted to fit thepictureConversion
, false if theblob
is put as it in the PictureView (without any conversion)- Returns:
- the computed picture view
-
computeViewsFor
public List<PictureView> computeViewsFor(Blob blob, List<PictureConversion> pictureConversions, boolean convert) Description copied from interface:ImagingService
- Specified by:
computeViewsFor
in interfaceImagingService
convert
- true if theblob
is converted to fit eachPictureConversion
, false if theblob
is put as it in the PictureView (without any conversion)- Returns:
- the computed picture views as a List of
PictureView
s
-
computeViewsFor
public List<PictureView> computeViewsFor(Blob blob, List<PictureConversion> pictureConversions, ImageInfo imageInfo, boolean convert) Description copied from interface:ImagingService
- Specified by:
computeViewsFor
in interfaceImagingService
imageInfo
- theImageInfo
to use when computing the viewconvert
- true if theblob
is converted to fit eachPictureConversion
, false if theblob
is put as it in the PictureView (without any conversion)- Returns:
- the computed picture views as a List of
PictureView
s
-
computeView
protected PictureView computeView(Blob blob, PictureConversion pictureConversion, ImageInfo imageInfo, boolean convert) -
computeView
protected PictureView computeView(DocumentModel doc, Blob blob, PictureConversion pictureConversion, ImageInfo imageInfo, boolean convert) -
wrapBlob
-
computeView
protected PictureView computeView(DocumentModel doc, Blob blob, PictureConversion pictureConversion, ImageInfo imageInfo) -
callPictureConversionChain
protected Blob callPictureConversionChain(DocumentModel doc, Blob blob, PictureConversion pictureConversion, ImageInfo imageInfo, Point size, String conversionFormat) -
computeViewsFor
public List<PictureView> computeViewsFor(DocumentModel doc, Blob blob, ImageInfo imageInfo, boolean convert) Description copied from interface:ImagingService
Compute all the registeredPictureConversion
For each picture template theImagingService.computeViewFor(Blob, PictureConversion, ImageInfo, boolean)
method is call- Specified by:
computeViewsFor
in interfaceImagingService
-
canApplyPictureConversion
-
createActionContext
-
computeViewWithoutConversion
protected PictureView computeViewWithoutConversion(Blob blob, PictureConversion pictureConversion, ImageInfo imageInfo) -
getSize
Deprecated.since 11.1 useImageResizer.scaleToMax(int, int, int)
instead. -
computeViewsFor
public List<List<PictureView>> computeViewsFor(List<Blob> blobs, List<PictureConversion> pictureConversions, boolean convert) Description copied from interface:ImagingService
- Specified by:
computeViewsFor
in interfaceImagingService
convert
- true if theblob
is converted to fit eachPictureConversion
, false if theblob
is put as it in the PictureView (without any conversion)
-
computeViewsFor
public List<List<PictureView>> computeViewsFor(List<Blob> blobs, List<PictureConversion> pictureConversions, ImageInfo imageInfo, boolean convert) Description copied from interface:ImagingService
- Specified by:
computeViewsFor
in interfaceImagingService
imageInfo
- theImageInfo
to use when computing the viewconvert
- true if theblob
is converted to fit eachPictureConversion
, false if theblob
is put as it in the PictureView (without any conversion)
-
ImageResizer.scaleToMax(int, int, int)
instead.