com.atlassian.confluence.pages.thumbnail
Interface ThumbnailManager

All Known Implementing Classes:
DefaultThumbnailManager

public interface ThumbnailManager


Field Summary
static String THUMBNAIL_IMAGE_DARK_FEATURE
           
static String THUMBNAIL_PATH_SUFFIX
           
 
Method Summary
 com.atlassian.core.util.thumbnail.Thumbnail getThumbnail(Attachment attachment)
          Returns a thumbnail for this attachment having ensured the thumbnail exists in the filesystem, generating it only if it doesn't already exist.
 com.atlassian.core.util.thumbnail.Thumbnail getThumbnail(Attachment attachment, ImageDimensions imageDimensions)
          Returns a thumbnail for this attachment having ensured the thumbnail exists in the filesystem, generating it only if it doesn't already exist.
 InputStream getThumbnailData(Attachment attachment)
          Retrieves the thumbnail data (as a stream) of the latest version from where it was stored in the file system.
 InputStream getThumbnailData(Attachment attachment, ImageDimensions imageDimensions)
          Retrieves the thumbnail data (as a stream) of the latest version from where it was stored in the file system.
 File getThumbnailFile(Attachment attachment)
          Returns the path to the thumbnail for this attachment
 File getThumbnailFile(Attachment attachment, ImageDimensions imageDimensions)
          Returns the path to the thumbnail for this attachment
 File getThumbnailFile(long attachmentId, int version, long contentId)
           
 ThumbnailInfo getThumbnailInfo(Attachment attachment)
          Return the details of a thumbnail for a given attachment without actually creating the thumbnail file on disk.
 ThumbnailInfo getThumbnailInfo(Attachment attachment, ImageDimensions imageDimensions)
          Return the details of a thumbnail for a given attachment without actually creating the thumbnail file on disk.
 ThumbnailInfo getThumbnailInfo(Attachment attachment, String rootAttachmentPath)
          Return the details of a thumbnail for a given attachment without actually creating the thumbnail file on disk.
 ThumbnailInfo getThumbnailInfo(Attachment attachment, String rootAttachmentPath, ImageDimensions imageDimensions)
          Return the details of a thumbnail for a given attachment without actually creating the thumbnail file on disk.
 Collection<com.atlassian.core.util.thumbnail.Thumbnail> getThumbnails(Collection<Attachment> attachments)
          Deprecated. since 5.4. No replacement.
 boolean isThumbnailable(Attachment attachment)
          Checks the content type/mime type of the attachment to determine whether a thumbnail can be created from it
 boolean isThumbnailable(InputStream imageData)
          Deprecated. since 5.4.
 boolean isThumbnailable(ThumbnailInfo info)
          Check the thumbnail information to determine whether a thumbnail can be created from it
 boolean removeThumbnail(Attachment attachment)
          Removes the thumbnail for the specified attachment
 

Field Detail

THUMBNAIL_PATH_SUFFIX

static final String THUMBNAIL_PATH_SUFFIX

THUMBNAIL_IMAGE_DARK_FEATURE

static final String THUMBNAIL_IMAGE_DARK_FEATURE
See Also:
Constant Field Values
Method Detail

getThumbnails

@Deprecated
Collection<com.atlassian.core.util.thumbnail.Thumbnail> getThumbnails(Collection<Attachment> attachments)
                                                                      throws Exception
Deprecated. since 5.4. No replacement.

Throws:
Exception

isThumbnailable

boolean isThumbnailable(@Nullable
                        Attachment attachment)
Checks the content type/mime type of the attachment to determine whether a thumbnail can be created from it

Parameters:
attachment - the attachment
Returns:
true if the attachment can have thumbnail, otherwise false

getThumbnailData

InputStream getThumbnailData(@Nonnull
                             Attachment attachment)
                             throws FileNotFoundException
Retrieves the thumbnail data (as a stream) of the latest version from where it was stored in the file system. This function assumes that the thumbnail has been created i.e getThumbnail has been called.

Parameters:
attachment - the attachment
Returns:
the input stream of the thumbnail
Throws:
FileNotFoundException - if the thumbnail file is not found

getThumbnailData

InputStream getThumbnailData(@Nonnull
                             Attachment attachment,
                             @Nullable
                             ImageDimensions imageDimensions)
                             throws FileNotFoundException
Retrieves the thumbnail data (as a stream) of the latest version from where it was stored in the file system. This function assumes that the thumbnail has been created. i.e getThumbnail has been called.

Parameters:
attachment - the attachment
imageDimensions - image dimensions of the thumbnail
Returns:
the input stream of the thumbnail
Throws:
FileNotFoundException - if the thumbnail file is not found
Since:
5.7

getThumbnailFile

File getThumbnailFile(long attachmentId,
                      int version,
                      long contentId)

getThumbnailFile

File getThumbnailFile(@Nonnull
                      Attachment attachment)
Returns the path to the thumbnail for this attachment

Parameters:
attachment - the attachment
Returns:
the thumbnail file

getThumbnailFile

File getThumbnailFile(@Nonnull
                      Attachment attachment,
                      @Nullable
                      ImageDimensions imageDimensions)
Returns the path to the thumbnail for this attachment

Parameters:
attachment - the attachment
imageDimensions - image dimensions of the thumbnail
Returns:
the thumbnail file
Since:
5.7

removeThumbnail

boolean removeThumbnail(@Nonnull
                        Attachment attachment)
Removes the thumbnail for the specified attachment

Parameters:
attachment - the attachment
Returns:
true if the thumbnail was found and was successfully removed, false if no thumbnail was found or the thumbnail could not be removed

getThumbnail

com.atlassian.core.util.thumbnail.Thumbnail getThumbnail(@Nonnull
                                                         Attachment attachment)
                                                         throws IllegalArgumentException
Returns a thumbnail for this attachment having ensured the thumbnail exists in the filesystem, generating it only if it doesn't already exist. The size of the thumbnail is set by the application's configuration.

Parameters:
attachment - the attachment
Returns:
the thumbnail if the attachment
Throws:
IllegalArgumentException - if the attachment is an inappropriate type for thumbnailing, i.e. isThumbnailable(Attachment) returns false

getThumbnail

com.atlassian.core.util.thumbnail.Thumbnail getThumbnail(@Nonnull
                                                         Attachment attachment,
                                                         @Nullable
                                                         ImageDimensions imageDimensions)
                                                         throws IllegalArgumentException
Returns a thumbnail for this attachment having ensured the thumbnail exists in the filesystem, generating it only if it doesn't already exist. The size of the thumbnail is set in parameters, if it doesn't exist, then use the application's configuration.

Parameters:
attachment - the attachment
imageDimensions - image dimensions of the thumbnail
Returns:
the thumbnail of the attachment
Throws:
IllegalArgumentException - if the attachment is an inappropriate type for thumbnailing, i.e. isThumbnailable(Attachment) returns false
Since:
5.7

getThumbnailInfo

ThumbnailInfo getThumbnailInfo(@Nonnull
                               Attachment attachment)
                               throws CannotGenerateThumbnailException
Return the details of a thumbnail for a given attachment without actually creating the thumbnail file on disk. The address of the thumbnail will be rooted at the context path, rather than the base url. The thumbnail maximum size is taken from the global settings.

Parameters:
attachment - the attachment
Returns:
the thumbnail information of the attachment, never null
Throws:
CannotGenerateThumbnailException - if no thumbnail information can be generated for this thumbnail

getThumbnailInfo

ThumbnailInfo getThumbnailInfo(@Nonnull
                               Attachment attachment,
                               @Nullable
                               ImageDimensions imageDimensions)
                               throws CannotGenerateThumbnailException
Return the details of a thumbnail for a given attachment without actually creating the thumbnail file on disk. The address of the thumbnail will be rooted at the context path, rather than the base url. The thumbnail maximum size is set in parameters, if it doesn't exist, then taken from the global settings.

Parameters:
attachment - the attachment
imageDimensions - image dimensions of the thumbnail
Returns:
the thumbnail information of the attachment, never null
Throws:
CannotGenerateThumbnailException - if no thumbnail information can be generated for this thumbnail
Since:
5.7

getThumbnailInfo

ThumbnailInfo getThumbnailInfo(@Nonnull
                               Attachment attachment,
                               @Nullable
                               String rootAttachmentPath)
                               throws CannotGenerateThumbnailException
Return the details of a thumbnail for a given attachment without actually creating the thumbnail file on disk. The address of the thumbnail will be rooted at the context path, rather than the base url. The thumbnail maximum size is taken from the global settings.

Parameters:
attachment - the attachment
rootAttachmentPath - path to the thumbnail, excepting the thumbnail itself. Eg the value returned by ConfluenceRenderUtils.getAttachmentRemotePath(com.atlassian.confluence.pages.Attachment).
Returns:
the thumbnail information of the attachment, never null
Throws:
CannotGenerateThumbnailException - if no thumbnail information can be generated for this thumbnail

getThumbnailInfo

ThumbnailInfo getThumbnailInfo(@Nonnull
                               Attachment attachment,
                               @Nullable
                               String rootAttachmentPath,
                               @Nullable
                               ImageDimensions imageDimensions)
                               throws CannotGenerateThumbnailException
Return the details of a thumbnail for a given attachment without actually creating the thumbnail file on disk. The address of the thumbnail will be rooted at the context path, rather than the base url. The thumbnail maximum size is set in parameters, if it doesn't exist, then taken from the global settings.

Parameters:
attachment - the attachment
rootAttachmentPath - path to the thumbnail, excepting the thumbnail itself. Eg the value returned by ConfluenceRenderUtils.getAttachmentRemotePath(com.atlassian.confluence.pages.Attachment).
imageDimensions - image dimensions of the thumbnail
Returns:
thumbnail information for the attachment, never null
Throws:
CannotGenerateThumbnailException - if no thumbnail information can be generated for this thumbnail
Since:
5.7

isThumbnailable

boolean isThumbnailable(@Nullable
                        ThumbnailInfo info)
Check the thumbnail information to determine whether a thumbnail can be created from it

Parameters:
info - the thumbnail information
Returns:
true if it can have thumbnail, otherwise false

isThumbnailable

@Deprecated
boolean isThumbnailable(InputStream imageData)
Deprecated. since 5.4.



Copyright © 2003–2015 Atlassian. All rights reserved.