Skip to content

Commit

Permalink
AssetRendition: Log detected dimension in WARN message when width/hei…
Browse files Browse the repository at this point in the history
…ght could not be read from metadata (#35)
  • Loading branch information
stefanseifert authored Jan 17, 2024
1 parent 1b9c1b8 commit 1917ad8
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/main/java/io/wcm/handler/mediasource/dam/AssetRendition.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,17 @@ private static long getAssetMetadataValueAsLong(Asset asset, String... propertyN
boolean suppressLogWarningNoRenditionsMetadata) {
try (InputStream is = rendition.getStream()) {
if (is != null) {
Layer layer = new Layer(is);
long width = layer.getWidth();
long height = layer.getHeight();
Dimension dimension = toDimension(width, height);
if (!suppressLogWarningNoRenditionsMetadata) {
log.warn("Unable to detect rendition metadata for {}, "
+ "fallback to inefficient detection by loading image into in memory. "
+ "fallback to inefficient detection by loading image into in memory (detected dimension={}). "
+ "Please check if the service user for the bundle 'io.wcm.handler.media' is configured properly.",
rendition.getPath());
rendition.getPath(), dimension);
}
Layer layer = new Layer(is);
long width = layer.getWidth();
long height = layer.getHeight();
return toDimension(width, height);
return dimension;
}
else {
log.warn("Unable to get binary stream for rendition {}", rendition.getPath());
Expand Down

0 comments on commit 1917ad8

Please sign in to comment.