Browse Source

Enable custom config in test site.

Former-commit-id: 9d3fe8c5c1c085e76d8b411d71ef284f5f04c862
Former-commit-id: 9a377f179b234196485c7cfccec2223c6bf0fafc
pull/17/head
James South 12 years ago
parent
commit
c9ddeec805
  1. 22
      src/ImageProcessor.Playground/Program.cs
  2. 4
      src/TestWebsites/MVC/Web.config
  3. 16
      src/TestWebsites/MVC/config/imageprocessor/processing.config

22
src/ImageProcessor.Playground/Program.cs

@ -52,8 +52,8 @@ namespace ImageProcessor.PlayGround
// Image mask = Image.FromFile(Path.Combine(resolvedPath, "mask2.png")); // Image mask = Image.FromFile(Path.Combine(resolvedPath, "mask2.png"));
Image overlay = Image.FromFile(Path.Combine(resolvedPath, "monster.png")); Image overlay = Image.FromFile(Path.Combine(resolvedPath, "monster.png"));
//FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "cow_PNG2140.png")); //FileInfo fileInfo = new FileInfo(Path.Combine(resolvedPath, "monster.png"));
IEnumerable<FileInfo> files = GetFilesByExtensions(di, ".jpg"); IEnumerable<FileInfo> files = GetFilesByExtensions(di, ".png");
//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)
@ -69,7 +69,7 @@ namespace ImageProcessor.PlayGround
{ {
using (ImageFactory imageFactory = new ImageFactory(true)) using (ImageFactory imageFactory = new ImageFactory(true))
{ {
Size size = new Size(200, 200); Size size = new Size(844, 1017);
ResizeLayer layer = new ResizeLayer(size, ResizeMode.Max, AnchorPosition.Center, false); ResizeLayer layer = new ResizeLayer(size, ResizeMode.Max, AnchorPosition.Center, false);
//ContentAwareResizeLayer layer = new ContentAwareResizeLayer(size) //ContentAwareResizeLayer layer = new ContentAwareResizeLayer(size)
@ -78,13 +78,13 @@ namespace ImageProcessor.PlayGround
//}; //};
// Load, resize, set the format and quality and save an image. // Load, resize, set the format and quality and save an image.
imageFactory.Load(inStream) imageFactory.Load(inStream)
//.Overlay(new ImageLayer .Overlay(new ImageLayer
// { {
// Image = overlay, Image = overlay,
// Size = size, Size = size,
// Opacity = 80 Opacity = 80
// }) })
.Alpha(50) //.Alpha(50)
//.BackgroundColor(Color.White) //.BackgroundColor(Color.White)
//.Resize(new Size((int)(size.Width * 1.1), 0)) //.Resize(new Size((int)(size.Width * 1.1), 0))
//.ContentAwareResize(layer) //.ContentAwareResize(layer)
@ -107,7 +107,7 @@ namespace ImageProcessor.PlayGround
//.Filter(MatrixFilters.HiSatch) //.Filter(MatrixFilters.HiSatch)
//.Pixelate(8) //.Pixelate(8)
//.GaussianSharpen(10) //.GaussianSharpen(10)
//.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)));
stopwatch.Stop(); stopwatch.Stop();

4
src/TestWebsites/MVC/Web.config

@ -5,7 +5,7 @@
--> -->
<configuration> <configuration>
<!--<configSections> <configSections>
<sectionGroup name="imageProcessor"> <sectionGroup name="imageProcessor">
<section name="security" requirePermission="false" type="ImageProcessor.Web.Configuration.ImageSecuritySection, ImageProcessor.Web" /> <section name="security" requirePermission="false" type="ImageProcessor.Web.Configuration.ImageSecuritySection, ImageProcessor.Web" />
<section name="processing" requirePermission="false" type="ImageProcessor.Web.Configuration.ImageProcessingSection, ImageProcessor.Web" /> <section name="processing" requirePermission="false" type="ImageProcessor.Web.Configuration.ImageProcessingSection, ImageProcessor.Web" />
@ -16,7 +16,7 @@
<security configSource="config\imageprocessor\security.config" /> <security configSource="config\imageprocessor\security.config" />
<cache configSource="config\imageprocessor\cache.config" /> <cache configSource="config\imageprocessor\cache.config" />
<processing configSource="config\imageprocessor\processing.config" /> <processing configSource="config\imageprocessor\processing.config" />
</imageProcessor>--> </imageProcessor>
<appSettings> <appSettings>
<add key="webpages:Version" value="2.0.0.0" /> <add key="webpages:Version" value="2.0.0.0" />
<add key="webpages:Enabled" value="false" /> <add key="webpages:Enabled" value="false" />

16
src/TestWebsites/MVC/config/imageprocessor/processing.config

@ -27,7 +27,21 @@
<setting key="MaxThreshold" value="100"/> <setting key="MaxThreshold" value="100"/>
</settings> </settings>
</plugin> </plugin>
<plugin name="Hue" type="ImageProcessor.Web.Processors.Hue, ImageProcessor.Web"/>
<plugin name="Mask" type="ImageProcessor.Web.Processors.Mask, ImageProcessor.Web">
<settings>
<setting key="VirtualPath" value="~/images/imageprocessor/mask/"/>
</settings>
</plugin>
<plugin name="Meta" type="ImageProcessor.Web.Processors.Meta, ImageProcessor.Web"/>
<plugin name="Overlay" type="ImageProcessor.Web.Processors.Overlay, ImageProcessor.Web">
<settings>
<setting key="VirtualPath" value="~/images/imageprocessor/overlay/"/>
</settings>
</plugin>
<plugin name="Pixelate" type="ImageProcessor.Web.Processors.Pixelate, ImageProcessor.Web"/>
<plugin name="Quality" type="ImageProcessor.Web.Processors.Quality, ImageProcessor.Web"/> <plugin name="Quality" type="ImageProcessor.Web.Processors.Quality, ImageProcessor.Web"/>
<plugin name="ReplaceColor" type="ImageProcessor.Web.Processors.ReplaceColor, ImageProcessor.Web"/>
<plugin name="Resize" type="ImageProcessor.Web.Processors.Resize, ImageProcessor.Web"> <plugin name="Resize" type="ImageProcessor.Web.Processors.Resize, ImageProcessor.Web">
<settings> <settings>
<setting key="MaxWidth" value="5000"/> <setting key="MaxWidth" value="5000"/>
@ -41,4 +55,4 @@
<plugin name="Vignette" type="ImageProcessor.Web.Processors.Vignette, ImageProcessor.Web"/> <plugin name="Vignette" type="ImageProcessor.Web.Processors.Vignette, ImageProcessor.Web"/>
<plugin name="Watermark" type="ImageProcessor.Web.Processors.Watermark, ImageProcessor.Web"/> <plugin name="Watermark" type="ImageProcessor.Web.Processors.Watermark, ImageProcessor.Web"/>
</plugins> </plugins>
</processing> </processing>
Loading…
Cancel
Save