java.lang.Object
com.atlassian.confluence.impl.pages.thumbnail.renderer.ThumbnailRenderer

public class ThumbnailRenderer extends Object
  • Constructor Details

  • Method Details

    • createThumbnail

      public com.atlassian.core.util.thumbnail.Thumbnail createThumbnail(File inputFile, 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(InputStream inputStream, 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

      @Deprecated public static Dimensions imageDimensions(File inputFile)
      Deprecated.
      since 7.0.1 , use dimensions(File)
    • dimensions

      public static ImageDimensions dimensions(File inputFile)
      Since:
      7.0.1
    • imageDimensions

      @Deprecated public static Dimensions imageDimensions(InputStream inputStream)
      Deprecated.
      since 7.0.1 , use dimensions(InputStream)
    • dimensions

      public static ImageDimensions dimensions(InputStream inputStream)
      Since:
      7.0.1
    • withStreamConsumer

      public static <T> T withStreamConsumer(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