Skip to content

Commit

Permalink
Implements the "scale" filter to prevent image degradation (OrchardCM…
Browse files Browse the repository at this point in the history
  • Loading branch information
luciofassio authored and AndreaPiovanelli committed Jul 31, 2023
1 parent 356c832 commit f517103
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ public MediaShapes(Work<IImageProfileManager> imageProfileManager) {
public ILogger Logger { get; set; }

[Shape]
public void ResizeMediaUrl(dynamic Shape, dynamic Display, TextWriter Output, ContentItem ContentItem, string Path, int Width, int Height, string Mode, string Alignment, string PadColor) {
public void ResizeMediaUrl(dynamic Shape, dynamic Display, TextWriter Output, ContentItem ContentItem, string Path, int Width, int Height, string Mode, string Alignment, string PadColor, string Scale= "upscaleOnly") {
var state = new Dictionary<string, string> {
{"Width", Width.ToString(CultureInfo.InvariantCulture)},
{"Height", Height.ToString(CultureInfo.InvariantCulture)},
{"Mode", Mode},
{"Alignment", Alignment},
{"PadColor", PadColor},
{"Scale", Scale},
};

var filter = new FilterRecord {
Expand All @@ -42,7 +43,8 @@ public void ResizeMediaUrl(dynamic Shape, dynamic Display, TextWriter Output, Co
+ "_h_" + Convert.ToString(Height)
+ "_m_" + Convert.ToString(Mode)
+ "_a_" + Convert.ToString(Alignment)
+ "_c_" + Convert.ToString(PadColor);
+ "_c_" + Convert.ToString(PadColor)
+ "_s_" + Convert.ToString(Scale);

MediaUrl(Shape, Display, Output, profile, Path, ContentItem, filter);
}
Expand Down

0 comments on commit f517103

Please sign in to comment.