Browse Source

Fixing crop and saturation bugs

Former-commit-id: 5de3038fbf6ff74a61b880c623ee479ee94d26cb
Former-commit-id: 7800972e069b54bd95241e4ce22b99b1a8c6b073
af/merge-core
James South 11 years ago
parent
commit
d352fa4cc8
  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>
/// The regular expression to search strings for values between 1 and 100.
/// </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>
/// The sharpen regex.

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

@ -29,7 +29,7 @@ namespace ImageProcessor.Web.Processors
/// <summary>
/// The regular expression to search strings for.
/// </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>
/// The regular expression to search strings for the size attribute.
@ -111,8 +111,8 @@ namespace ImageProcessor.Web.Processors
{
if (match.Success)
{
// We don't want any resize carve requests to interfere.
if (match.Value.ToUpperInvariant().Contains("CARVE"))
// We don't want any resize carve or percentile crops requests to interfere.
if (match.Value.ToUpperInvariant().Contains("CARVE") || match.Value.ToUpperInvariant().Contains("PERCENT"))
{
break;
}

8
src/ImageProcessor/Processors/Crop.cs

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

2
src/TestWebsites/MVC/Test_Website_MVC.csproj

@ -228,7 +228,7 @@
</ProjectExtensions>
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<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>
<!-- 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.

Loading…
Cancel
Save