mraible commented on code in PR #315:
URL: https://github.com/apache/roller/pull/315#discussion_r4637394348
##########
app/src/main/java/org/apache/roller/weblogger/pojos/MediaFile.java:
##########
@@ -367,6 +371,46 @@ public String getThumbnailURL() {
.getMediaFileThumbnailURL(getWeblog(), this.getId(), true);
}
+ /**
+ * True for an image whose recorded size is over
uploads.thumbnail.maxPixels.
+ * Such images are stored without a thumbnail.
+ */
+ public boolean isOverThumbnailPixelLimit() {
+ if (!isImageFile() || getWidth() <= 0 || getHeight() <= 0) {
+ return false;
+ }
+ return (long) getWidth() * getHeight() > thumbnailMaxPixels();
Review Comment:
A follow-up on this one: checking only for the `_sm` file turned out to be
too strict, because on an upgraded blog most images have none (on
raibledesigns.com, 306 of 312 images, carried over from Roller 5 or by
migrations), and they would all have lost their previews.
`isThumbnailSkipped()` is now true only when there is no `_sm` file and the
recorded size is over the current limit, so an image with a thumbnail always
gets it and one without a thumbnail under the limit gets the original as before
#315. `testSmallImageWithoutThumbnailFileIsNotSkipped` covers the upgraded-file
case, and `testRaisingLimitAfterUploadServesOriginal` and
`testLoweringLimitAfterUploadKeepsThumbnail` cover changing the limit after
upload. Against a copy of that blog, all 308 thumbnail requests return 200 with
this change; the previous commit returned 404 for 306 of them.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]