Skip to content
Snippets Groups Projects
Commit 4c66f325 authored by tpylak's avatar tpylak
Browse files

minor: do not rescale thumbnails upwards

SVN: 19202
parent f663e18e
No related branches found
No related tags found
No related merge requests found
......@@ -237,7 +237,7 @@ public class ImageChannelsUtils
// resized the image if necessary
Size sizeOrNull = imageReference.tryGetSize();
if (sizeOrNull != null)
if (sizeOrNull != null && isRescalingNeeded(image, sizeOrNull))
{
start = operationLog.isDebugEnabled() ? System.currentTimeMillis() : 0;
image = ImageUtil.createThumbnail(image, sizeOrNull.getWidth(), sizeOrNull.getHeight());
......@@ -262,6 +262,12 @@ public class ImageChannelsUtils
return image;
}
// we do not want to generate thumnnails which are larger in any dimension than the original
private static boolean isRescalingNeeded(BufferedImage image, Size size)
{
return image.getWidth() > size.getWidth() || image.getHeight() > size.getHeight();
}
private static BufferedImage loadImage(AbsoluteImageReference imageReference)
{
IContent content = imageReference.getContent();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment