com.atlassian.confluence.pages.thumbnail.renderer
Class ThumbnailRenderer

java.lang.Object
  extended by com.atlassian.confluence.pages.thumbnail.renderer.ThumbnailRenderer

public class ThumbnailRenderer
extends java.lang.Object


Constructor Summary
ThumbnailRenderer(com.atlassian.core.util.thumbnail.Thumber thumber, com.google.common.base.Predicate<Dimensions> rasterBasedRenderingThreshold)
           
 
Method Summary
 com.atlassian.core.util.thumbnail.Thumbnail createThumbnail(java.io.File inputFile, java.io.File outputFile, int maxWidth, int maxHeight)
          Create a Thumbnail from the input file.
 com.atlassian.core.util.thumbnail.Thumbnail createThumbnail(java.io.InputStream inputStream, java.io.File outputFile, int maxWidth, int maxHeight)
          Create a Thumbnail from the input stream.
static Dimensions imageDimensions(java.io.File inputFile)
           
static Dimensions imageDimensions(java.io.InputStream inputStream)
           
static
<T> T
withStreamConsumer(java.io.InputStream inputStream, InputStreamConsumer<T> sc)
          Call the InputStreamConsumer with input stream ensuring that the input stream gets closed properly afterwards.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThumbnailRenderer

public ThumbnailRenderer(com.atlassian.core.util.thumbnail.Thumber thumber,
                         com.google.common.base.Predicate<Dimensions> rasterBasedRenderingThreshold)
Method Detail

createThumbnail

public com.atlassian.core.util.thumbnail.Thumbnail createThumbnail(java.io.File inputFile,
                                                                   java.io.File outputFile,
                                                                   int maxWidth,
                                                                   int maxHeight)
Create a Thumbnail from the input file. Thumbnails will always be PNG thumbnails!

Parameters:
inputFile - - The attachment that contains the image data
outputFile - - The thumbnail file that will be used to store the rendered thumbnail
maxWidth - - The maximum width of the thumbnail - this renderer maintains the aspect ratio of the original image
maxHeight - - The maximum height of the thumbnail - this renderer maintains the aspect ratio of the original image
Returns:
Thumbnail that is at most maxWidthxmaxHeight, never returns null
Throws:
ThumbnailRenderException - if the thumbnail cannot be created.

createThumbnail

public com.atlassian.core.util.thumbnail.Thumbnail createThumbnail(java.io.InputStream inputStream,
                                                                   java.io.File outputFile,
                                                                   int maxWidth,
                                                                   int maxHeight)
Create a Thumbnail from the input stream. Thumbnails will always be PNG thumbnails!

Parameters:
inputStream - - The stream that contains the image data
outputFile - - The thumbnail file that will be used to store the rendered thumbnail
maxWidth - - The maximum width of the thumbnail - this renderer maintains the aspect ratio of the original image
maxHeight - - The maximum height of the thumbnail - this renderer maintains the aspect ratio of the original image
Returns:
Thumbnail that is at most maxWidthxmaxHeight, never returns null
Throws:
ThumbnailRenderException - if the thumbnail cannot be created.

imageDimensions

public static Dimensions imageDimensions(java.io.File inputFile)

imageDimensions

public static Dimensions imageDimensions(java.io.InputStream inputStream)

withStreamConsumer

public static <T> T withStreamConsumer(java.io.InputStream inputStream,
                                       InputStreamConsumer<T> sc)
Call the InputStreamConsumer with input stream ensuring that the input stream gets closed properly afterwards.

Parameters:
inputStream - The stream containing the image data
sc - The InputStreamConsumer that consumes the file data InputStream


Copyright © 2003-2014 Atlassian. All Rights Reserved.