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


##########
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:
   `isOverThumbnailPixelLimit()` is now `isThumbnailSkipped()`, which no longer 
reads the limit and is true for an image whose size was read on upload but 
which has no `_sm` file stored; the servlet and views use it, and no schema 
change was needed. `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