Class ImageResolverHelper

    • Method Detail

      • resolveImageAsBase64

        public static final String resolveImageAsBase64​(InputStream dataIs,
                                                        String mimeType,
                                                        int height,
                                                        int width,
                                                        int maxHeight,
                                                        int maxWidth)
                                                 throws IOException
        Get an image's bytes encoded as base64, optionally resized.
        Parameters:
        dataIs - an input stream on the image bytes.
        mimeType - the image mime type.
        height - the specified height. Ignored if negative.
        width - the specified width. Ignored if negative.
        maxHeight - the maximum image height. Ignored if height or width is specified.
        maxWidth - the maximum image width. Ignored if height or width is specified.
        Returns:
        the image bytes encoded as base64.
        Throws:
        IOException - if an error occurs.
      • resolveImageAsBase64

        public static final String resolveImageAsBase64​(InputStream dataIs,
                                                        String mimeType,
                                                        int height,
                                                        int width,
                                                        int maxHeight,
                                                        int maxWidth,
                                                        int cropHeight,
                                                        int cropWidth)
                                                 throws IOException
        Get an image's bytes encoded as base64, optionally resized.
        Parameters:
        dataIs - an input stream on the image bytes.
        mimeType - the image mime type.
        height - the specified height. Ignored if 0.
        width - the specified width. Ignored if 0.
        maxHeight - the maximum image height. Ignored if height or width is specified.
        maxWidth - the maximum image width. Ignored if height or width is specified.
        cropHeight - the cropping height. Ignored if 0.
        cropWidth - the cropping width. Ignored if 0.
        Returns:
        the image bytes encoded as base64.
        Throws:
        IOException - if an error occurs.