mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-27 12:29:04 +08:00
Fixes #7815
This commit is contained in:
committed by
Sébastien Ros
parent
a4240b107a
commit
375c935ec7
@@ -32,6 +32,7 @@ namespace Orchard.MediaProcessing.Providers.Filters {
|
|||||||
string mode = context.State.Mode;
|
string mode = context.State.Mode;
|
||||||
string alignment = context.State.Alignment;
|
string alignment = context.State.Alignment;
|
||||||
string padcolor = context.State.PadColor;
|
string padcolor = context.State.PadColor;
|
||||||
|
string scale = context.State.Scale;
|
||||||
|
|
||||||
var settings = new ResizeSettings {
|
var settings = new ResizeSettings {
|
||||||
Mode = FitMode.Max,
|
Mode = FitMode.Max,
|
||||||
@@ -70,6 +71,13 @@ namespace Orchard.MediaProcessing.Providers.Filters {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (scale) {
|
||||||
|
case "downscaleOnly": settings.Scale = ScaleMode.DownscaleOnly; break;
|
||||||
|
case "upscaleOnly": settings.Scale = ScaleMode.UpscaleOnly; break;
|
||||||
|
case "both": settings.Scale = ScaleMode.Both; break;
|
||||||
|
case "upscaleCanvas": settings.Scale = ScaleMode.UpscaleCanvas; break;
|
||||||
|
}
|
||||||
|
|
||||||
var result = new MemoryStream();
|
var result = new MemoryStream();
|
||||||
if (context.Media.CanSeek) {
|
if (context.Media.CanSeek) {
|
||||||
context.Media.Seek(0, SeekOrigin.Begin);
|
context.Media.Seek(0, SeekOrigin.Begin);
|
||||||
@@ -135,7 +143,13 @@ namespace Orchard.MediaProcessing.Providers.Filters {
|
|||||||
Title: T("Pad Color"),
|
Title: T("Pad Color"),
|
||||||
Value: "",
|
Value: "",
|
||||||
Description: T("The background color to use to pad the image e.g., #ffffff, red. Leave empty to keep transparency."),
|
Description: T("The background color to use to pad the image e.g., #ffffff, red. Leave empty to keep transparency."),
|
||||||
Classes: new[] {"text small"})
|
Classes: new[] {"text small"}),
|
||||||
|
_Scale: Shape.SelectList(
|
||||||
|
Id: "scale", Name: "Scale",
|
||||||
|
Title: T("Scale"),
|
||||||
|
Description: T("Select the scale mode which defines whether the image is allowed to upscale, downscale, both, or if only the canvas gets to be upscaled."),
|
||||||
|
Size: 1,
|
||||||
|
Multiple: false)
|
||||||
);
|
);
|
||||||
|
|
||||||
f._Mode.Add(new SelectListItem { Value = "max", Text = T("Max").Text });
|
f._Mode.Add(new SelectListItem { Value = "max", Text = T("Max").Text });
|
||||||
@@ -153,6 +167,11 @@ namespace Orchard.MediaProcessing.Providers.Filters {
|
|||||||
f._Alignment.Add(new SelectListItem { Value = "bottomcenter", Text = T("Bottom Center").Text });
|
f._Alignment.Add(new SelectListItem { Value = "bottomcenter", Text = T("Bottom Center").Text });
|
||||||
f._Alignment.Add(new SelectListItem { Value = "bottomright", Text = T("Bottom Right").Text });
|
f._Alignment.Add(new SelectListItem { Value = "bottomright", Text = T("Bottom Right").Text });
|
||||||
|
|
||||||
|
f._Scale.Add(new SelectListItem { Value = "downscaleOnly", Text = T("Downscale only").Text });
|
||||||
|
f._Scale.Add(new SelectListItem { Value = "upscaleOnly", Text = T("Upscale only").Text });
|
||||||
|
f._Scale.Add(new SelectListItem { Value = "both", Text = T("Both").Text });
|
||||||
|
f._Scale.Add(new SelectListItem { Value = "upscaleCanvas", Text = T("Upscale canvas").Text });
|
||||||
|
|
||||||
return f;
|
return f;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user