mraible commented on code in PR #327:
URL: https://github.com/apache/roller/pull/327#discussion_r4637394589


##########
app/src/main/java/org/apache/roller/weblogger/pojos/MediaFile.java:
##########
@@ -366,6 +370,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 shown the file icon. 
`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 after the limit is raised a file stored without one gets the 
original instead of the icon, as other images without a thumbnail do. 
`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]

Reply via email to