public class DefaultThumbnailManager extends Object implements ThumbnailManager
THUMBNAIL_IMAGE_DARK_FEATURE, THUMBNAIL_PATH_SUFFIX
Constructor and Description |
---|
DefaultThumbnailManager() |
Modifier and Type | Method and Description |
---|---|
com.atlassian.core.util.thumbnail.Thumbnail |
getThumbnail(@NonNull 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(@NonNull Attachment attachment,
@Nullable 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(@NonNull Attachment attachment)
Retrieves the thumbnail data (as a stream) of the latest version from where it was stored in the file system.
|
InputStream |
getThumbnailData(@NonNull Attachment attachment,
@Nullable ImageDimensions imageDimensions)
Retrieves the thumbnail data (as a stream) of the latest version from where it was stored in the file system.
|
File |
getThumbnailFile(@NonNull Attachment attachment)
Returns the path to the thumbnail for this attachment
|
File |
getThumbnailFile(@NonNull Attachment attachment,
@Nullable ImageDimensions imageDimensions)
Returns the path to the thumbnail for this attachment
|
File |
getThumbnailFile(long attachmentId,
int version,
long contentId) |
ThumbnailInfo |
getThumbnailInfo(@NonNull Attachment attachment)
Return the details of a thumbnail for a given attachment without actually creating the thumbnail file on disk.
|
ThumbnailInfo |
getThumbnailInfo(@NonNull Attachment attachment,
@Nullable ImageDimensions imageDimensions)
Return the details of a thumbnail for a given attachment without actually creating the thumbnail file on disk.
|
ThumbnailInfo |
getThumbnailInfo(@NonNull Attachment attachment,
@Nullable String remoteAttachmentPath)
Return the details of a thumbnail for a given attachment without actually creating the thumbnail file on disk.
|
ThumbnailInfo |
getThumbnailInfo(@NonNull Attachment attachment,
@Nullable String remoteAttachmentPath,
@Nullable ImageDimensions imageDimensions)
Return the details of a thumbnail for a given attachment without actually creating the thumbnail file on disk.
|
protected File |
getThumbnailsFolder(Attachment attachment) |
boolean |
isThumbnailable(@Nullable Attachment attachment)
Checks the content type/mime type of the attachment to determine whether a thumbnail can be created from it
|
static boolean |
isThumbnailable(String mimeType) |
boolean |
isThumbnailable(@NonNull ThumbnailInfo info)
Check the thumbnail information to determine whether a thumbnail can be created from it
|
boolean |
removeThumbnail(@NonNull Attachment attachment)
Removes the thumbnail for the specified attachment
|
void |
setBootstrapManager(BootstrapManager bootstrapManager) |
void |
setImageDetailsManager(ImageDetailsManager imageDetailsManager) |
void |
setSettingsManager(SettingsManager settingsManager) |
void |
setThumbnailRenderer(DelegatingThumbnailRenderer thumbnailRenderer) |
public boolean isThumbnailable(@Nullable Attachment attachment)
ThumbnailManager
isThumbnailable
in interface ThumbnailManager
attachment
- the attachmentpublic static boolean isThumbnailable(String mimeType)
public boolean isThumbnailable(@NonNull ThumbnailInfo info)
ThumbnailManager
isThumbnailable
in interface ThumbnailManager
info
- the thumbnail informationpublic InputStream getThumbnailData(@NonNull Attachment attachment) throws FileNotFoundException
getThumbnailData
in interface ThumbnailManager
attachment
- the attachmentFileNotFoundException
- if the thumbnail file is not foundpublic InputStream getThumbnailData(@NonNull Attachment attachment, @Nullable ImageDimensions imageDimensions) throws FileNotFoundException
getThumbnailData
in interface ThumbnailManager
attachment
- the attachmentimageDimensions
- image dimensions of the thumbnailFileNotFoundException
- if the thumbnail file is not foundpublic com.atlassian.core.util.thumbnail.Thumbnail getThumbnail(@NonNull Attachment attachment) throws IllegalArgumentException
getThumbnail
in interface ThumbnailManager
attachment
- the attachmentIllegalArgumentException
- if the attachment is an inappropriate type for thumbnailing, i.e. ThumbnailManager.isThumbnailable(Attachment)
returns falsepublic com.atlassian.core.util.thumbnail.Thumbnail getThumbnail(@NonNull Attachment attachment, @Nullable ImageDimensions imageDimensions) throws IllegalArgumentException
getThumbnail
in interface ThumbnailManager
attachment
- the attachmentimageDimensions
- image dimensions of the thumbnailIllegalArgumentException
- if the attachment is an inappropriate type for thumbnailing, i.e. ThumbnailManager.isThumbnailable(Attachment)
returns falsepublic ThumbnailInfo getThumbnailInfo(@NonNull Attachment attachment) throws CannotGenerateThumbnailException
getThumbnailInfo
in interface ThumbnailManager
attachment
- the attachmentCannotGenerateThumbnailException
- if no thumbnail information can be generated for this thumbnailpublic ThumbnailInfo getThumbnailInfo(@NonNull Attachment attachment, @Nullable ImageDimensions imageDimensions) throws CannotGenerateThumbnailException
getThumbnailInfo
in interface ThumbnailManager
attachment
- the attachmentimageDimensions
- image dimensions of the thumbnailCannotGenerateThumbnailException
- if no thumbnail information can be generated for this thumbnailpublic ThumbnailInfo getThumbnailInfo(@NonNull Attachment attachment, @Nullable String remoteAttachmentPath) throws CannotGenerateThumbnailException
getThumbnailInfo
in interface ThumbnailManager
attachment
- the attachmentremoteAttachmentPath
- path to the thumbnail, excepting the thumbnail itself. Eg the value returned by ConfluenceRenderUtils.getAttachmentRemotePath(com.atlassian.confluence.pages.Attachment)
.CannotGenerateThumbnailException
- if no thumbnail information can be generated for this thumbnailpublic ThumbnailInfo getThumbnailInfo(@NonNull Attachment attachment, @Nullable String remoteAttachmentPath, @Nullable ImageDimensions imageDimensions) throws CannotGenerateThumbnailException
getThumbnailInfo
in interface ThumbnailManager
attachment
- the attachmentremoteAttachmentPath
- 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 thumbnailCannotGenerateThumbnailException
- if no thumbnail information can be generated for this thumbnailpublic void setBootstrapManager(BootstrapManager bootstrapManager)
protected File getThumbnailsFolder(Attachment attachment)
public File getThumbnailFile(@NonNull Attachment attachment)
getThumbnailFile
in interface ThumbnailManager
attachment
- the attachmentpublic File getThumbnailFile(@NonNull Attachment attachment, @Nullable ImageDimensions imageDimensions)
getThumbnailFile
in interface ThumbnailManager
attachment
- the attachmentimageDimensions
- image dimensions of the thumbnailpublic File getThumbnailFile(long attachmentId, int version, long contentId)
getThumbnailFile
in interface ThumbnailManager
public boolean removeThumbnail(@NonNull Attachment attachment)
removeThumbnail
in interface ThumbnailManager
attachment
- the attachmentpublic void setThumbnailRenderer(DelegatingThumbnailRenderer thumbnailRenderer)
public void setSettingsManager(SettingsManager settingsManager)
public void setImageDetailsManager(ImageDetailsManager imageDetailsManager)
Copyright © 2003–2020 Atlassian. All rights reserved.