Browse Source

prefixed requests no longer require a querystring

Former-commit-id: 20431e2c1072865a5e352fc0a4fb0d0e1c33a164
Former-commit-id: 75ad92152d9d586fc88efe27bebc7c3044f1edc0
af/merge-core
James South 12 years ago
parent
commit
dfa7b8ca5d
  1. 10
      src/ImageProcessor.Playground/Program.cs
  2. 16
      src/ImageProcessor.Web/HttpModules/ImageProcessingModule.cs

10
src/ImageProcessor.Playground/Program.cs

@ -53,7 +53,7 @@ namespace ImageProcessor.PlayGround
Image mask = Image.FromFile(Path.Combine(resolvedPath, "mask.png")); Image mask = Image.FromFile(Path.Combine(resolvedPath, "mask.png"));
Image overlay = Image.FromFile(Path.Combine(resolvedPath, "imageprocessor.128.png")); Image overlay = Image.FromFile(Path.Combine(resolvedPath, "imageprocessor.128.png"));
//FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "monster.png")); //FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "monster.png"));
IEnumerable<FileInfo> files = GetFilesByExtensions(di, ".jpg"); IEnumerable<FileInfo> files = GetFilesByExtensions(di, ".gif");
//IEnumerable<FileInfo> files = GetFilesByExtensions(di, ".gif", ".webp", ".bmp", ".jpg", ".png", ".tif"); //IEnumerable<FileInfo> files = GetFilesByExtensions(di, ".gif", ".webp", ".bmp", ".jpg", ".png", ".tif");
foreach (FileInfo fileInfo in files) foreach (FileInfo fileInfo in files)
@ -88,11 +88,10 @@ namespace ImageProcessor.PlayGround
//.Resize(new Size((int)(size.Width * 1.1), 0)) //.Resize(new Size((int)(size.Width * 1.1), 0))
//.ContentAwareResize(layer) //.ContentAwareResize(layer)
//.Constrain(size) //.Constrain(size)
//.Rotate(-64)
//.Mask(mask) //.Mask(mask)
//.Format(new PngFormat()) //.Format(new PngFormat())
//.BackgroundColor(Color.Cyan) //.BackgroundColor(Color.Cyan)
.ReplaceColor(Color.FromArgb(255, 223, 224), Color.FromArgb(121, 188, 255), 128) //.ReplaceColor(Color.FromArgb(255, 223, 224), Color.FromArgb(121, 188, 255), 128)
//.Resize(size) //.Resize(size)
// .Resize(new ResizeLayer(size, ResizeMode.Max)) // .Resize(new ResizeLayer(size, ResizeMode.Max))
// .Resize(new ResizeLayer(size, ResizeMode.Stretch)) // .Resize(new ResizeLayer(size, ResizeMode.Stretch))
@ -104,9 +103,10 @@ namespace ImageProcessor.PlayGround
//.Filter(MatrixFilters.Comic) //.Filter(MatrixFilters.Comic)
//.Flip() //.Flip()
//.Filter(MatrixFilters.HiSatch) //.Filter(MatrixFilters.HiSatch)
//.Pixelate(8) .Pixelate(8)
.Rotate(45)
//.GaussianSharpen(10) //.GaussianSharpen(10)
.Format(new PngFormat()) //.Format(new PngFormat() { IsIndexed = true })
//.Format(new PngFormat() { IsIndexed = true }) //.Format(new PngFormat() { IsIndexed = true })
//.Save(Path.GetFullPath(Path.Combine(Path.GetDirectoryName(path), @"..\..\images\output", fileInfo.Name))); //.Save(Path.GetFullPath(Path.Combine(Path.GetDirectoryName(path), @"..\..\images\output", fileInfo.Name)));
.Save(Path.GetFullPath(Path.Combine(Path.GetDirectoryName(path), @"..\..\images\output", Path.GetFileNameWithoutExtension(fileInfo.Name) + ".png"))); .Save(Path.GetFullPath(Path.Combine(Path.GetDirectoryName(path), @"..\..\images\output", Path.GetFileNameWithoutExtension(fileInfo.Name) + ".png")));

16
src/ImageProcessor.Web/HttpModules/ImageProcessingModule.cs

@ -315,14 +315,25 @@ namespace ImageProcessor.Web.HttpModules
} }
} }
else else
{
if (string.IsNullOrWhiteSpace(currentService.Prefix))
{ {
requestPath = HostingEnvironment.MapPath(request.Path); requestPath = HostingEnvironment.MapPath(request.Path);
queryString = HttpUtility.UrlDecode(request.QueryString.ToString()); queryString = HttpUtility.UrlDecode(request.QueryString.ToString());
} }
else
{
requestPath = HttpUtility.UrlDecode(request.QueryString.ToString());
}
}
// Only process requests that pass our sanitizing filter. // If the current service doesn't require a prefix, don't fetch it.
if (!string.IsNullOrWhiteSpace(queryString)) // Let the static file handler take over.
if (string.IsNullOrWhiteSpace(currentService.Prefix) && string.IsNullOrWhiteSpace(queryString))
{ {
return;
}
// Replace any presets in the querystring with the actual value. // Replace any presets in the querystring with the actual value.
queryString = this.ReplacePresetsInQueryString(queryString); queryString = this.ReplacePresetsInQueryString(queryString);
@ -463,7 +474,6 @@ namespace ImageProcessor.Web.HttpModules
} }
} }
} }
}
/// <summary> /// <summary>
/// This will make the browser and server keep the output /// This will make the browser and server keep the output

Loading…
Cancel
Save