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


##########
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:
   Rather than record a flag in a new column, `isOverThumbnailPixelLimit()` is 
now `isThumbnailSkipped()`, which decides from what was stored: an image whose 
size was read on upload but which has no `_sm` file, whatever the limit is now, 
and the servlet and views use it, so `?t=true` still gets the file icon after 
the limit is raised. `testRaisingLimitAfterUploadKeepsThumbnailSkipped` and 
`testLoweringLimitAfterUploadKeepsThumbnail` in `MediaFileThumbnailTest` change 
the limit after upload, and one side effect is that an under-limit image whose 
header was readable but whose thumbnail couldn't be made now also gets the file 
icon instead of the original.



-- 
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