Browse Source

Fixing crop and saturation bugs

Former-commit-id: 537370dcae945b6d9f4b773153d6ac60a8ece9b7
Former-commit-id: 038c715e0df653273b4710d9408f4022d722e9cc
pull/17/head
James South 12 years ago
parent
commit
7153b182c2
  1. 2
      src/ImageProcessor.Web/Helpers/CommonParameterParserUtility.cs
  2. 6
      src/ImageProcessor.Web/Processors/Resize.cs
  3. 8
      src/ImageProcessor/Processors/Crop.cs
  4. 2
      src/TestWebsites/MVC/Test_Website_MVC.csproj

2
src/ImageProcessor.Web/Helpers/CommonParameterParserUtility.cs

@ -44,7 +44,7 @@ namespace ImageProcessor.Web.Helpers
/// <summary> /// <summary>
/// The regular expression to search strings for values between 1 and 100. /// The regular expression to search strings for values between 1 and 100.
/// </summary> /// </summary>
private static readonly Regex In100RangeRegex = new Regex(@"(-?(0*(?:[1-9][0-9]?|100)))", RegexOptions.Compiled); private static readonly Regex In100RangeRegex = new Regex(@"(-?0*(?:100|[1-9][0-9]?))", RegexOptions.Compiled);
/// <summary> /// <summary>
/// The sharpen regex. /// The sharpen regex.

6
src/ImageProcessor.Web/Processors/Resize.cs

@ -29,7 +29,7 @@ namespace ImageProcessor.Web.Processors
/// <summary> /// <summary>
/// The regular expression to search strings for. /// The regular expression to search strings for.
/// </summary> /// </summary>
private static readonly Regex QueryRegex = new Regex(@"(width|height)=|(width|height)ratio=|mode=(carve)?|anchor=|center=|upscale=", RegexOptions.Compiled); private static readonly Regex QueryRegex = new Regex(@"(width|height)=|(width|height)ratio=|mode=(carve|percent)?|anchor=|center=|upscale=", RegexOptions.Compiled);
/// <summary> /// <summary>
/// The regular expression to search strings for the size attribute. /// The regular expression to search strings for the size attribute.
@ -111,8 +111,8 @@ namespace ImageProcessor.Web.Processors
{ {
if (match.Success) if (match.Success)
{ {
// We don't want any resize carve requests to interfere. // We don't want any resize carve or percentile crops requests to interfere.
if (match.Value.ToUpperInvariant().Contains("CARVE")) if (match.Value.ToUpperInvariant().Contains("CARVE") || match.Value.ToUpperInvariant().Contains("PERCENT"))
{ {
break; break;
} }

8
src/ImageProcessor/Processors/Crop.cs

@ -126,11 +126,11 @@ namespace ImageProcessor.Processors
GraphicsUnit.Pixel, GraphicsUnit.Pixel,
wrapMode); wrapMode);
} }
// Reassign the image.
image.Dispose();
image = newImage;
} }
// Reassign the image.
image.Dispose();
image = newImage;
} }
} }
catch (Exception ex) catch (Exception ex)

2
src/TestWebsites/MVC/Test_Website_MVC.csproj

@ -228,7 +228,7 @@
</ProjectExtensions> </ProjectExtensions>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" /> <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<Target Name="AfterBuild"> <Target Name="AfterBuild">
<Exec Command="xcopy &quot;$(SolutionDir)Images&quot; &quot;$(ProjectDir)Images&quot; /S /Y /I" /> <Exec Command="xcopy &quot;$(SolutionDir)ImageProcessor.UnitTests\Images&quot; &quot;$(ProjectDir)Images&quot; /S /Y /I" />
</Target> </Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.

Loading…
Cancel
Save