Class DefaultThumbnailManager
java.lang.Object
com.atlassian.confluence.pages.thumbnail.DefaultThumbnailManager
- All Implemented Interfaces:
ThumbnailManagerInternal,ThumbnailManager
-
Field Summary
Fields inherited from interface com.atlassian.confluence.pages.thumbnail.ThumbnailManager
THUMBNAIL_IMAGE_DARK_FEATURE, THUMBNAIL_PATH_SUFFIXFields inherited from interface com.atlassian.confluence.impl.pages.thumbnail.ThumbnailManagerInternal
THUMBNAIL_DIR_NAME -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.atlassian.core.util.thumbnail.ThumbnailgetThumbnail(@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.ThumbnailgetThumbnail(@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.getThumbnailData(@NonNull Attachment attachment) Retrieves the thumbnail data (as a stream) of the latest version from where it was stored in the file system.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.getThumbnailInfo(@NonNull Attachment attachment) Return the details of a thumbnail for a given attachment without actually creating the thumbnail file on disk.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.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.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.com.atlassian.dc.filestore.api.compat.FilesystemPathgetThumbnailPath(long attachmentId, int version, long contentId) com.atlassian.dc.filestore.api.compat.FilesystemPathgetThumbnailPath(@NonNull Attachment attachment, @Nullable ImageDimensions imageDimensions) protected FilegetThumbnailsFolder(Attachment attachment) Deprecated.since 7.14booleanisThumbnailable(@NonNull ThumbnailInfo info) Check the thumbnail information to determine whether a thumbnail can be created from itbooleanisThumbnailable(@Nullable Attachment attachment) Checks the content type/mime type of the attachment to determine whether a thumbnail can be created from itstatic booleanisThumbnailable(String mimeType) booleanremoveThumbnail(@NonNull Attachment attachment) Removes the thumbnail for the specified attachmentvoidsetBootstrapManager(BootstrapManager bootstrapManager) voidsetConfluenceHome(com.atlassian.dc.filestore.api.compat.FilesystemPath confluenceHome) voidsetImageDetailsManager(ImageDetailsManager imageDetailsManager) voidsetSettingsManager(GlobalSettingsManager settingsManager) voidsetSettingsManager(SettingsManager settingsManager) Deprecated.since 7.20 UsesetSettingsManager(GlobalSettingsManager)voidsetThumbnailRenderer(DelegatingThumbnailRenderer thumbnailRenderer) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.atlassian.confluence.impl.pages.thumbnail.ThumbnailManagerInternal
getThumbnailFile, getThumbnailFile, getThumbnailFile
-
Constructor Details
-
DefaultThumbnailManager
public DefaultThumbnailManager()
-
-
Method Details
-
isThumbnailable
Description copied from interface:ThumbnailManagerChecks the content type/mime type of the attachment to determine whether a thumbnail can be created from it- Specified by:
isThumbnailablein interfaceThumbnailManager- Parameters:
attachment- the attachment- Returns:
- true if the attachment can have thumbnail, otherwise false
-
isThumbnailable
-
isThumbnailable
Description copied from interface:ThumbnailManagerCheck the thumbnail information to determine whether a thumbnail can be created from it- Specified by:
isThumbnailablein interfaceThumbnailManager- Parameters:
info- the thumbnail information- Returns:
- true if it can have thumbnail, otherwise false
-
getThumbnailData
Description copied from interface:ThumbnailManagerRetrieves 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.- Specified by:
getThumbnailDatain interfaceThumbnailManager- Parameters:
attachment- the attachment- Returns:
- the input stream of the thumbnail
- Throws:
FileNotFoundException- if the thumbnail file is not found
-
getThumbnailData
public InputStream getThumbnailData(@NonNull Attachment attachment, @Nullable ImageDimensions imageDimensions) throws FileNotFoundException Description copied from interface:ThumbnailManagerRetrieves 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.- Specified by:
getThumbnailDatain interfaceThumbnailManager- Parameters:
attachment- the attachmentimageDimensions- image dimensions of the thumbnail- Returns:
- the input stream of the thumbnail
- Throws:
FileNotFoundException- if the thumbnail file is not found
-
getThumbnail
public com.atlassian.core.util.thumbnail.Thumbnail getThumbnail(@NonNull Attachment attachment) throws IllegalArgumentException Description copied from interface:ThumbnailManagerReturns 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.- Specified by:
getThumbnailin interfaceThumbnailManager- Parameters:
attachment- the attachment- Returns:
- the thumbnail if the attachment
- Throws:
IllegalArgumentException- if the attachment is an inappropriate type for thumbnailing, i.e.ThumbnailManager.isThumbnailable(Attachment)returns false
-
getThumbnail
public com.atlassian.core.util.thumbnail.Thumbnail getThumbnail(@NonNull Attachment attachment, @Nullable ImageDimensions imageDimensions) throws IllegalArgumentException Description copied from interface:ThumbnailManagerReturns 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.- Specified by:
getThumbnailin interfaceThumbnailManager- Parameters:
attachment- the attachmentimageDimensions- image dimensions of the thumbnail- Returns:
- the thumbnail of the attachment
- Throws:
IllegalArgumentException- if the attachment is an inappropriate type for thumbnailing, i.e.ThumbnailManager.isThumbnailable(Attachment)returns false
-
getThumbnailInfo
public ThumbnailInfo getThumbnailInfo(@NonNull Attachment attachment) throws CannotGenerateThumbnailException Description copied from interface:ThumbnailManagerReturn 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.- Specified by:
getThumbnailInfoin interfaceThumbnailManager- 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
public ThumbnailInfo getThumbnailInfo(@NonNull Attachment attachment, @Nullable ImageDimensions imageDimensions) throws CannotGenerateThumbnailException Description copied from interface:ThumbnailManagerReturn 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.- Specified by:
getThumbnailInfoin interfaceThumbnailManager- Parameters:
attachment- the attachmentimageDimensions- 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
-
getThumbnailInfo
public ThumbnailInfo getThumbnailInfo(@NonNull Attachment attachment, @Nullable String remoteAttachmentPath) throws CannotGenerateThumbnailException Description copied from interface:ThumbnailManagerReturn 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.- Specified by:
getThumbnailInfoin interfaceThumbnailManager- Parameters:
attachment- the attachmentremoteAttachmentPath- path to the thumbnail, excepting the thumbnail itself. Eg the value returned byConfluenceRenderUtils.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
public ThumbnailInfo getThumbnailInfo(@NonNull Attachment attachment, @Nullable String remoteAttachmentPath, @Nullable ImageDimensions imageDimensions) throws CannotGenerateThumbnailException Description copied from interface:ThumbnailManagerReturn 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.- Specified by:
getThumbnailInfoin interfaceThumbnailManager- Parameters:
attachment- the attachmentremoteAttachmentPath- path to the thumbnail, excepting the thumbnail itself. Eg the value returned byConfluenceRenderUtils.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
-
setBootstrapManager
-
setConfluenceHome
public void setConfluenceHome(com.atlassian.dc.filestore.api.compat.FilesystemPath confluenceHome) -
getThumbnailsFolder
Deprecated.since 7.14 -
getThumbnailPath
public com.atlassian.dc.filestore.api.compat.FilesystemPath getThumbnailPath(@NonNull Attachment attachment, @Nullable ImageDimensions imageDimensions) - Specified by:
getThumbnailPathin interfaceThumbnailManagerInternal
-
getThumbnailPath
public com.atlassian.dc.filestore.api.compat.FilesystemPath getThumbnailPath(long attachmentId, int version, long contentId) - Specified by:
getThumbnailPathin interfaceThumbnailManagerInternal
-
removeThumbnail
Removes the thumbnail for the specified attachment- Specified by:
removeThumbnailin interfaceThumbnailManager- 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
-
setThumbnailRenderer
-
setSettingsManager
Deprecated.since 7.20 UsesetSettingsManager(GlobalSettingsManager) -
setSettingsManager
- Since:
- 7.20
-
setImageDetailsManager
-