public class ThumbnailRenderer extends Object
| Constructor and Description |
|---|
ThumbnailRenderer(com.atlassian.core.util.thumbnail.Thumber thumber,
com.google.common.base.Predicate<Dimensions> rasterBasedRenderingThreshold) |
| Modifier and Type | Method and Description |
|---|---|
com.atlassian.core.util.thumbnail.Thumbnail |
createThumbnail(File inputFile,
File outputFile,
int maxWidth,
int maxHeight)
Create a
Thumbnail from the input file. |
com.atlassian.core.util.thumbnail.Thumbnail |
createThumbnail(InputStream inputStream,
File outputFile,
int maxWidth,
int maxHeight)
Create a
Thumbnail from the input stream. |
static Dimensions |
imageDimensions(File inputFile) |
static Dimensions |
imageDimensions(InputStream inputStream) |
static <T> T |
withStreamConsumer(InputStream inputStream,
InputStreamConsumer<T> sc)
Call the
InputStreamConsumer with input stream ensuring that the input stream gets closed properly
afterwards. |
public ThumbnailRenderer(com.atlassian.core.util.thumbnail.Thumber thumber,
com.google.common.base.Predicate<Dimensions> rasterBasedRenderingThreshold)
public com.atlassian.core.util.thumbnail.Thumbnail createThumbnail(File inputFile, File outputFile, int maxWidth, int maxHeight)
Thumbnail from the input file. Thumbnails will always be PNG thumbnails!inputFile - - The attachment that contains the image dataoutputFile - - The thumbnail file that will be used to store the rendered thumbnailmaxWidth - - The maximum width of the thumbnail - this renderer maintains the aspect ratio of the original
imagemaxHeight - - The maximum height of the thumbnail - this renderer maintains the aspect ratio of the original
imagemaxWidthxmaxHeight, never returns nullThumbnailRenderException - if the thumbnail cannot be created.public com.atlassian.core.util.thumbnail.Thumbnail createThumbnail(InputStream inputStream, File outputFile, int maxWidth, int maxHeight)
Thumbnail from the input stream. Thumbnails will always be PNG thumbnails!inputStream - - The stream that contains the image dataoutputFile - - The thumbnail file that will be used to store the rendered thumbnailmaxWidth - - The maximum width of the thumbnail - this renderer maintains the aspect ratio of the original
imagemaxHeight - - The maximum height of the thumbnail - this renderer maintains the aspect ratio of the original
imagemaxWidthxmaxHeight, never returns nullThumbnailRenderException - if the thumbnail cannot be created.public static Dimensions imageDimensions(File inputFile)
public static Dimensions imageDimensions(InputStream inputStream)
public static <T> T withStreamConsumer(InputStream inputStream, InputStreamConsumer<T> sc)
InputStreamConsumer with input stream ensuring that the input stream gets closed properly
afterwards.inputStream - The stream containing the image datasc - The InputStreamConsumer that consumes the file data InputStreamCopyright © 2003–2017 Atlassian. All rights reserved.