Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert committed Sep 20, 2022
2 parents 46c6492 + f2480fc commit 890a2b7
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
4 changes: 4 additions & 0 deletions changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
xsi:schemaLocation="http://maven.apache.org/changes/1.0.0 http://maven.apache.org/plugins/maven-changes-plugin/xsd/changes-1.0.0.xsd">
<body>

<release version="1.14.8" date="2022-09-20">
<action type="fix" dev="sseifert">Dynamic Media Support: Make use of smart-cropped image rendition also in the case if the original image has same ratio as the requested ratio.</action>
</release>

<release version="1.14.6" date="2022-09-02">
<action type="fix" dev="sseifert"><![CDATA[
Dynamic Media Support: Apply Site URL detection with <code>&lt;auto&gt;</code> when building Dynamic Media URLs in author instance.
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

<groupId>io.wcm</groupId>
<artifactId>io.wcm.handler.media</artifactId>
<version>1.14.6</version>
<version>1.14.8</version>
<packaging>jar</packaging>

<name>Media Handler</name>
Expand All @@ -49,7 +49,7 @@
<site.url.module.prefix>handler/media</site.url.module.prefix>

<!-- Enable reproducible builds -->
<project.build.outputTimestamp>2022-09-02T08:01:37Z</project.build.outputTimestamp>
<project.build.outputTimestamp>2022-09-20T21:06:06Z</project.build.outputTimestamp>
</properties>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,9 @@ private DynamicMediaPath() {
StringBuilder result = new StringBuilder();
result.append(IMAGE_SERVER_PATH).append(encodeDynamicMediaObject(damContext));

if (cropDimension != null && cropDimension.isAutoCrop() && rotation == null) {
// auto-crop applied - check for matching image profile and use predefined cropping preset if match found
// check for smart cropping when no cropping was applied by default, or auto-crop is enabled
if ((cropDimension == null || cropDimension.isAutoCrop()) && rotation == null) {
// check for matching image profile and use predefined cropping preset if match found
Optional<NamedDimension> smartCroppingDef = getSmartCropDimension(damContext, width, height);
if (smartCroppingDef.isPresent()) {
result.append("%3A").append(smartCroppingDef.get().getName()).append("?")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,14 @@ void setUp() {

@Test
void testWidthHeight() {
String result = DynamicMediaPath.buildImage(damContext, 30, 25);
assertEquals("/is/image/DummyFolder/test?wid=30&hei=25&fit=stretch", result);
}

@Test
void testWidthHeight_ImplicitSmartCrop() {
String result = DynamicMediaPath.buildImage(damContext, 30, 20);
assertEquals("/is/image/DummyFolder/test?wid=30&hei=20&fit=stretch", result);
assertEquals("/is/image/DummyFolder/test%3ACrop-1?wid=30&hei=20&fit=stretch", result);
}

@Test
Expand Down

0 comments on commit 890a2b7

Please sign in to comment.