Class DefaultGalleryProcessor

    • Field Detail

    • Constructor Detail

      • DefaultGalleryProcessor

        public DefaultGalleryProcessor()
    • Method Detail

      • setThumbnailSize

        public void setThumbnailSize​(int thumbnailSize)
      • getThumbnailSize

        public int getThumbnailSize()
      • createThumbnail

        public InputStream createThumbnail​(InputStream imageData,
                                           int maxSize,
                                           String mimeType)
                                    throws GalleryException
        Creates a thumbnail version of an image. The maxsize parameter determines how the image is scaled: it is the maximum size of both the width and height. If the original height is greater than the original width, then the height of the scaled image will be equal to max size. The same goes for the original width: if it is greater than the original height, the width of the scaled image is equal to maxsize.
        Parameters:
        imageData - the original image data; the input stream is closed by this method.
        maxSize - the maximum height or width of the scaled image
        mimeType - the mime type of the image
        Returns:
        the scaled image stream
        Throws:
        GalleryException
      • getScaledInstance

        public BufferedImage getScaledInstance​(BufferedImage img,
                                               int targetWidth,
                                               int targetHeight,
                                               Object hint,
                                               boolean higherQuality)
        Convenience method that returns a scaled instance of the provided BufferedImage.
        Parameters:
        img - the original image to be scaled
        targetWidth - the desired width of the scaled instance, in pixels
        targetHeight - the desired height of the scaled instance, in pixels
        hint - one of the rendering hints that corresponds to RenderingHints.KEY_INTERPOLATION (e.g. RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR, RenderingHints.VALUE_INTERPOLATION_BILINEAR, RenderingHints.VALUE_INTERPOLATION_BICUBIC)
        higherQuality - if true, this method will use a multi-step scaling technique that provides higher quality than the usual one-step technique (only useful in downscaling cases, where targetWidth or targetHeight is smaller than the original dimensions, and generally only when the BILINEAR hint is specified)
        Returns:
        a scaled version of the original BufferedImage
      • makeRegularImage

        protected void makeRegularImage​(javax.jcr.Node node,
                                        String name,
                                        InputStream istream,
                                        String mimeType,
                                        Calendar lastModified)
                                 throws javax.jcr.RepositoryException
        Throws:
        javax.jcr.RepositoryException