Skip to content

Commit

Permalink
[SERV-1068] Only set fallback thumbail on static images (#239)
Browse files Browse the repository at this point in the history
* Only set fallback thumbail on static images
* Fix tests, update .snyk
* Update Docker image deps
  • Loading branch information
ksclarke committed Apr 8, 2024
1 parent a29e582 commit 105e753
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 38 deletions.
4 changes: 4 additions & 0 deletions .snyk
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,7 @@ ignore:
- '*':
reason: Service is deprecated; moving to GoLang
expires: 2024-12-01
'SNYK-JAVA-IONETTY-6483812':
- '*':
reason: Service is deprecated; moving to GoLang
expires: 2024-12-01
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<ubuntu.tag>22.04</ubuntu.tag>
<jdk.version>17.0.10+7-1~22.04.1</jdk.version>
<python3.version>3.10.6-1~22.04</python3.version>
<curl.version>7.81.0-1ubuntu1.15</curl.version>
<curl.version>7.81.0-1ubuntu1.16</curl.version>

<!-- Application dependencies -->
<vertx.version>3.9.16</vertx.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ private Canvas[] createCanvases(final CsvHeaders aCsvHeaders, final List<String[

String resourceURI =
StringUtils.format(Constants.SAMPLE_URI_TEMPLATE, pageURI, Constants.DEFAULT_SAMPLE_SIZE);
boolean staticImage = false;
ImageResource imageResource;
ImageContent imageContent;
Canvas canvas;
Expand All @@ -494,6 +495,7 @@ private Canvas[] createCanvases(final CsvHeaders aCsvHeaders, final List<String[
imageResource = new ImageResource(accessURI);
imageResource.setWidth(mediaWidth);
imageResource.setHeight(mediaHeight);
staticImage = true;
} else {
// If we don't have both width and height in the CSV, we can also try to look it up
final ImageInfoLookup infoLookup = new ImageInfoLookup(pageURI);
Expand Down Expand Up @@ -524,7 +526,7 @@ private Canvas[] createCanvases(final CsvHeaders aCsvHeaders, final List<String[
// Add a thumbnail if we have one and one hasn't already been added
if (thumbnail.isPresent() && canvas.getThumbnail() == null) {
canvas.setThumbnail(thumbnail.get());
} else {
} else if (staticImage) {
// Fallback to using the original image as thumbnail and let browser resize
canvas.setThumbnail(accessURI);
}
Expand Down
Loading

0 comments on commit 105e753

Please sign in to comment.