Commit 06025da5 authored by Erdem Karakus's avatar Erdem Karakus

CMS-11257 temporary image file won't be deleted when original image used

When original image used instead of scaled image in the scaling
operation, original image file on the file system won't be deleted.
parent bc45d293
......@@ -285,10 +285,12 @@ public class ScaleImageOperation extends AbstractImageOperation {
scaledWidth = scaledImage.getWidth();
scaledHeight = scaledImage.getHeight();
// if the scale size equals to the original image size use the image which has the smaller weight
if (scaledOutputStream.toByteArray().length > IOUtils.toByteArray(dataInputStream).length
&& scaledWidth == originalWidth && scaledHeight == originalHeight) {
// if the scaled image dimensions equals to the original image dimensions and
// scaled image weight is bigger than the original image weight, use original image
if (scaledWidth == originalWidth && scaledHeight == originalHeight
&& scaledOutputStream.toByteArray().length > IOUtils.toByteArray(dataInputStream).length) {
scaledData = new AutoDeletingTmpFileInputStream(tmpFile);
deleteTmpFile = false;
} else {
scaledData = new ByteArrayInputStream(scaledOutputStream.toByteArray());
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment