Class StandardImageHandler

  • All Implemented Interfaces:
    AssetHandler

    @Service
    public class StandardImageHandler
    extends AbstractAssetHandler
    The StandardImageHandler supports currently following image types:
    • gif
    • png
    • photoshop
    • jpeg
    • tiff
    • bmp
    • Constructor Detail

      • StandardImageHandler

        public StandardImageHandler()
    • Method Detail

      • getMimeTypes

        public java.lang.String[] getMimeTypes()
        Description copied from interface: AssetHandler
        This method returns the mime types a particular AssetHandler supports.
        Returns:
        mime type, e.g. image/jpg
        See Also:
        AssetHandler.getMimeTypes()
      • extractMetadata

        public ExtractedMetadata extractMetadata​(Asset asset)
        Description copied from interface: AssetHandler
        This method is used by the ExtractMetadataProcess as part of the DAM Update Asset workflow during import or update of an asset. Implementations must return an ExtractedMetadata object, which may be empty if no metadata is extracted, or contains the metadata values extracted from the binary being imported/updated at the time. The ExtractMetadataProcess will later save the metadata contained in ExtractedMetadata to the asset's metadata node (e.g. /content/dam/geometrixx/banners/banner-mono.png/jcr:content/metadata). Implementations are free to decide which and how many metadata values are extracted.

        The method argument represents the Node of type nt:file holding the binary content or the DAM Asset node (type dam:Asset), for which its original rendition would be retrieved.

        Parameters:
        asset - The Asset, from whose original binary metadata will extracted.
        Returns:
        The extracted metadata.
      • getImage

        public java.awt.image.BufferedImage getImage​(Rendition rendition)
                                              throws java.io.IOException
        This method retrieves the graphical representation of an Assets given Rendition. For images the BufferedImage of the original image is returned, for other formats the first page is retrieved as BufferedImage
        Specified by:
        getImage in interface AssetHandler
        Overrides:
        getImage in class AbstractAssetHandler
        Parameters:
        rendition - The rendition for which to retrieve its graphical representation.
        Returns:
        BufferedImage if a graphical representation exists, otherwise null
        Throws:
        java.io.IOException - in case an error is thrown while fetching the buffered image
      • getImage

        public java.awt.image.BufferedImage getImage​(Rendition rendition,
                                                     java.awt.Dimension maxDimension)
                                              throws java.io.IOException
        This method retrieves the graphical representation of an Assets given Rendition. For images the BufferedImage of the original image is returned, for other formats the first page is retrieved as BufferedImage.

        If maxDimension is given, the handler should return an image where no dimension extends the given value. This can be used to reduce the memory footprint of large buffered images if the full resolution is not needed.

        Specified by:
        getImage in interface AssetHandler
        Overrides:
        getImage in class AbstractAssetHandler
        Parameters:
        rendition - The rendition for which to retrieve its graphical representation.
        maxDimension - optional constraint for the maximal dimension of the image.
        Returns:
        BufferedImage if a graphical representation exists, otherwise null
        Throws:
        java.io.IOException - in case an error is thrown while fetching the buffered image