public class

ThumbnailInfo

extends Object
java.lang.Object
   ↳ com.atlassian.confluence.pages.thumbnail.ThumbnailInfo

Class Overview

Responsible for setting the height and width of thumbnails appropriately and generating the HTML for rendering them in a page.

Summary

Constants
int THUMBNAIL_DEFAULT_WIDTH
Public Constructors
@Deprecated ThumbnailInfo(Attachment attachment, InputStream attachmentData, String attachmentsPath)
ThumbnailInfo(ImageDetails imageDetails, Dimensions maxDimensions, String attachmentsPath)
Creates a thumbnail info for the given image details and maximum dimensions.
Public Methods
static String createThumbnailUrlPathFromAttachmentUrl(String attachmentUrl)
Attachment getAttachment()
String getImageMimeType()
Returns the MIME type of the thumbnail if it is an intelligible image, or null otherwise.
int getOriginalHeight()
Get the height of the attachment before thumbnailing
int getOriginalWidth()
Get the width of the attachment before thumbnailing
String getPopupLink(String imageParameters)
Get some HTML that will cause a thumbnail to be rendered inline, with a popup-link to the full-sized image.
String getPopupLinkPrefix()
This method generates an a tag with the 'confluence-thumbnail-link' class.
String getPopupLinkSuffix()
int getThumbnailHeight()
Get the height of the thumbnail image.
String getThumbnailImageHtml(String imageParameters)
String getThumbnailUrlPath()
Get the URL path for downloading the thumbnail, relative to the application's context-root
int getThumbnailWidth()
Get the width of the thumbnail image.
static boolean systemSupportsThumbnailing()
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int THUMBNAIL_DEFAULT_WIDTH

Constant Value: 300 (0x0000012c)

Public Constructors

@Deprecated public ThumbnailInfo (Attachment attachment, InputStream attachmentData, String attachmentsPath)

This constructor is deprecated.
since 3.1 use ThumbnailInfo(ImageDetails, Dimensions, String), or getThumbnailInfo(com.atlassian.confluence.pages.Attachment, String)

Creates a thumbnail for an attachment.

Parameters
attachmentData is no longer used or required, so can be null

public ThumbnailInfo (ImageDetails imageDetails, Dimensions maxDimensions, String attachmentsPath)

Creates a thumbnail info for the given image details and maximum dimensions. The attachmentPath is used to generate a thumbnail URL.

Throws
IllegalArgumentException if imageDetails or its attachment is null

Public Methods

public static String createThumbnailUrlPathFromAttachmentUrl (String attachmentUrl)

public Attachment getAttachment ()

public String getImageMimeType ()

Returns the MIME type of the thumbnail if it is an intelligible image, or null otherwise.

public int getOriginalHeight ()

Get the height of the attachment before thumbnailing

Returns
  • the width in pixels of the attachment before thumbnailing, or -1 if the attachment is not an image which is thumbnailable

public int getOriginalWidth ()

Get the width of the attachment before thumbnailing

Returns
  • the width in pixels of the attachment before thumbnailing, or -1 if the attachment is not an image which is thumbnailable

public String getPopupLink (String imageParameters)

Get some HTML that will cause a thumbnail to be rendered inline, with a popup-link to the full-sized image. You can optionally supply some additional parameters to include in the img tag. This method generates an a tag with the 'confluence-thumbnail-link' class. The 'image-effects.js' file will attach an onclick function during the page initialisation.

Parameters
imageParameters a string of parameters suitable for inserting into an HTML img tag. Ignored if null.
Returns
  • the appropriate popup image HTML

public String getPopupLinkPrefix ()

This method generates an a tag with the 'confluence-thumbnail-link' class. The 'image-effects.js' file will attach an onclick function during the page initialisation.

Returns
  • the popup prefix html

public String getPopupLinkSuffix ()

public int getThumbnailHeight ()

Get the height of the thumbnail image. This should never be greater than the configured maximum thumbnail height.

Returns
  • the height of the thumbnail image in pixels

public String getThumbnailImageHtml (String imageParameters)

public String getThumbnailUrlPath ()

Get the URL path for downloading the thumbnail, relative to the application's context-root

Returns
  • the path for downloading the thumbnail, relative to the application's context-root;

public int getThumbnailWidth ()

Get the width of the thumbnail image. This should never be greater than the configured maximum thumbnail width.

Returns
  • the width of the thumbnail image in pixels

public static boolean systemSupportsThumbnailing ()