Package org.ametys.cms.transformation
Class ImageResolverHelper
- java.lang.Object
-
- org.ametys.cms.transformation.ImageResolverHelper
-
public final class ImageResolverHelper extends Object
Class providing helper methods to resolve images.
-
-
Constructor Summary
Constructors Modifier Constructor Description private
ImageResolverHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
resolveImageAsBase64(InputStream dataIs, String mimeType, int height, int width, int maxHeight, int maxWidth)
Get an image's bytes encoded as base64, optionally resized.static String
resolveImageAsBase64(InputStream dataIs, String mimeType, int height, int width, int maxHeight, int maxWidth, int cropHeight, int cropWidth)
Get an image's bytes encoded as base64, optionally resized.
-
-
-
Constructor Detail
-
ImageResolverHelper
private 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.
-
-