Browse Source

Adding preset resize restrictions

Fixes #31


Former-commit-id: 441439e6e59f04af142613c7661675830f41e613
af/merge-core
James South 12 years ago
parent
commit
b5a8ff65be
  1. 12
      src/ImageProcessor/Processors/Resize.cs
  2. 1
      src/TestWebsites/NET45/Test_Website_NET45/config/imageprocessor/processing.config

12
src/ImageProcessor/Processors/Resize.cs

@ -356,7 +356,7 @@ namespace ImageProcessor.Processors
bool reject = true;
foreach (Size restrictedSize in restrictedSizes)
{
if (restrictedSize.Width == width || restrictedSize.Height == height)
if (restrictedSize.Width == width && restrictedSize.Height == height)
{
reject = false;
}
@ -593,8 +593,14 @@ namespace ImageProcessor.Processors
/// </returns>
private List<Size> ParseRestrictions(string input)
{
string[] splitInput = input.Split(',');
return splitInput.Select(this.ParseSize).ToList();
List<Size> sizes = new List<Size>();
if (!string.IsNullOrWhiteSpace(input))
{
sizes.AddRange(input.Split(',').Select(this.ParseSize));
}
return sizes;
}
}
}

1
src/TestWebsites/NET45/Test_Website_NET45/config/imageprocessor/processing.config

@ -30,6 +30,7 @@
<settings>
<setting key="MaxWidth" value="3000"/>
<setting key="MaxHeight" value="3000"/>
<!--<setting key="RestrictTo" value="width=300height=300,width=300height=300"/>-->
</settings>
</plugin>
<plugin name="Rotate" type="ImageProcessor.Processors.Rotate, ImageProcessor"/>

Loading…
Cancel
Save