From 5f3f698ffde341ad065b6db3458bab2c28519ef1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Asbj=C3=B8rn=20Riis-Knudsen?= Date: Sun, 24 Jul 2016 18:09:06 +0200 Subject: [PATCH] U4-8751: Put format parameter at the end when format is specified in furtherOptions --- src/Umbraco.Web/ImageCropperTemplateExtensions.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web/ImageCropperTemplateExtensions.cs b/src/Umbraco.Web/ImageCropperTemplateExtensions.cs index bcdea6eb03..0068f1547e 100644 --- a/src/Umbraco.Web/ImageCropperTemplateExtensions.cs +++ b/src/Umbraco.Web/ImageCropperTemplateExtensions.cs @@ -302,7 +302,11 @@ namespace Umbraco.Web } } - if (quality != null) + bool hasFormat = furtherOptions != null && furtherOptions.Contains("&format="); + + //Only put quality here, if we don't have a format specified. + //Otherwise we need to put quality at the end to avoid it being overridden by the format. + if (quality != null && !hasFormat) { imageProcessorUrl.Append("&quality=" + quality); } @@ -351,6 +355,12 @@ namespace Umbraco.Web imageProcessorUrl.Append(furtherOptions); } + //If furtherOptions contains a format, we need to put the quality after the format. + if (quality != null && hasFormat) + { + imageProcessorUrl.Append("&quality=" + quality); + } + if (cacheBusterValue != null) { imageProcessorUrl.Append("&rnd=").Append(cacheBusterValue);