Package io.wcm.handler.mediasource.dam
Class AssetRendition
- java.lang.Object
-
- io.wcm.handler.mediasource.dam.AssetRendition
-
@ProviderType public final class AssetRendition extends java.lang.Object
Helper methods for getting metadata for DAM renditions.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static @Nullable Dimension
getDimension(@NotNull com.day.cq.dam.api.Rendition rendition)
Get dimension (width, height) of given DAM rendition.static @Nullable Dimension
getDimension(@NotNull com.day.cq.dam.api.Rendition rendition, boolean suppressLogWarningNoRenditionsMetadata)
Get dimension (width, height) of given DAM rendition.static java.lang.String
getFilename(@NotNull com.day.cq.dam.api.Rendition rendition)
Get file name of given rendition.static boolean
isOriginal(@NotNull com.day.cq.dam.api.Rendition rendition)
Checks if the given rendition is the original file of the assetstatic boolean
isThumbnailRendition(@NotNull com.day.cq.dam.api.Rendition rendition)
Checks if the given rendition is a thumbnail rendition generated automatically by AEM (withcq5dam.thumbnail.
prefix).static boolean
isWebRendition(@NotNull com.day.cq.dam.api.Rendition rendition)
Checks if the given rendition is a web rendition generated automatically by AEM for the image editor/cropping (withcq5dam.web.
prefix).
-
-
-
Method Detail
-
getDimension
@Nullable public static @Nullable Dimension getDimension(@NotNull @NotNull com.day.cq.dam.api.Rendition rendition)
Get dimension (width, height) of given DAM rendition.It reads the dimension information from the asset metadata for the original rendition, or from the rendition metadata generated by the "DamRenditionMetadataService". If both is not available it gets the dimension from the renditions binary file, but this is inefficient and should not happen under sound conditions.
- Parameters:
rendition
- Rendition- Returns:
- Dimension or null if dimension could not be detected, not even in fallback mode
-
getDimension
@Nullable public static @Nullable Dimension getDimension(@NotNull @NotNull com.day.cq.dam.api.Rendition rendition, boolean suppressLogWarningNoRenditionsMetadata)
Get dimension (width, height) of given DAM rendition.It reads the dimension information from the asset metadata for the original rendition, or from the rendition metadata generated by the "DamRenditionMetadataService". If both is not available it gets the dimension from the renditions binary file, but this is inefficient and should not happen under sound conditions.
- Parameters:
rendition
- RenditionsuppressLogWarningNoRenditionsMetadata
- If set to true, no log warnings is generated when renditions metadata containing the width/height of the rendition does not exist (yet).- Returns:
- Dimension or null if dimension could not be detected, not even in fallback mode
-
isOriginal
public static boolean isOriginal(@NotNull @NotNull com.day.cq.dam.api.Rendition rendition)
Checks if the given rendition is the original file of the asset- Parameters:
rendition
- DAM rendition- Returns:
- true if rendition is the original
-
isThumbnailRendition
public static boolean isThumbnailRendition(@NotNull @NotNull com.day.cq.dam.api.Rendition rendition)
Checks if the given rendition is a thumbnail rendition generated automatically by AEM (withcq5dam.thumbnail.
prefix).- Parameters:
rendition
- DAM rendition- Returns:
- true if rendition is a thumbnail rendition
-
isWebRendition
public static boolean isWebRendition(@NotNull @NotNull com.day.cq.dam.api.Rendition rendition)
Checks if the given rendition is a web rendition generated automatically by AEM for the image editor/cropping (withcq5dam.web.
prefix).- Parameters:
rendition
- DAM rendition- Returns:
- true if rendition is a web rendition
-
getFilename
public static java.lang.String getFilename(@NotNull @NotNull com.day.cq.dam.api.Rendition rendition)
Get file name of given rendition. If it is the original rendition get asset name as file name.- Parameters:
rendition
- Rendition- Returns:
- File extension or null if it could not be detected
-
-