Browse Source

Fixing bgcolor regex

Former-commit-id: 2a4b1cabe71720612c9bdee080a8ca1378d7283e
af/merge-core
James South 13 years ago
parent
commit
25ad2d3cb9
  1. 8
      src/ImageProcessor/Processors/Resize.cs
  2. 13
      src/TestWebsites/NET45/Test_Website_NET45/Views/Home/Index.cshtml

8
src/ImageProcessor/Processors/Resize.cs

@ -30,7 +30,7 @@ namespace ImageProcessor.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)=\d+)|(mode=(pad|stretch|crop))|(bgcolor-([0-9a-fA-F]{3}){1,2})", RegexOptions.Compiled); private static readonly Regex QueryRegex = new Regex(@"((width|height)=\d+)|(mode=(pad|stretch|crop))|(bgcolor=([0-9a-fA-F]{3}){1,2})", RegexOptions.Compiled);
/// <summary> /// <summary>
/// The regular expression to search strings for the size attribute. /// The regular expression to search strings for the size attribute.
@ -45,7 +45,7 @@ namespace ImageProcessor.Processors
/// <summary> /// <summary>
/// The regular expression to search strings for the color attribute. /// The regular expression to search strings for the color attribute.
/// </summary> /// </summary>
private static readonly Regex ColorRegex = new Regex(@"bgcolor-([0-9a-fA-F]{3}){1,2}", RegexOptions.Compiled); private static readonly Regex ColorRegex = new Regex(@"bgcolor=([0-9a-fA-F]{3}){1,2}", RegexOptions.Compiled);
#region IGraphicsProcessor Members #region IGraphicsProcessor Members
/// <summary> /// <summary>
@ -249,8 +249,8 @@ namespace ImageProcessor.Processors
{ {
foreach (Match match in ColorRegex.Matches(input)) foreach (Match match in ColorRegex.Matches(input))
{ {
// split on color-hex // Split on color-hex
return ColorTranslator.FromHtml("#" + match.Value.Split('-')[1]); return ColorTranslator.FromHtml("#" + match.Value.Split('=')[1]);
} }
return Color.Transparent; return Color.Transparent;

13
src/TestWebsites/NET45/Test_Website_NET45/Views/Home/Index.cshtml

@ -17,17 +17,14 @@
</div> </div>
</div> </div>
</section> </section>
<section> <section>
<div class="row"> <div class="row">
<div class="column-6"> <h2>Padded</h2>
<h2>Padded</h2> <div class="column-4">
<img src="/images/Penguins.jpg?width=300&height=500" /> <img src="/images/Penguins.jpg?width=300&height=500" />
@* <h3>Foreign language test.</h3>
<img src="/images/udendørs.jpg?width=300" />*@
</div> </div>
<div class="column-6"> <div class="column-8">
@* <h2>Cropped </h2> <img src="/images/udendørs.jpg?width=600&height=250" />
<img src="/images/Penguins.jpg?crop=0-0-300-225" />*@
</div> </div>
</div> </div>
</section> </section>

Loading…
Cancel
Save