Browse Source

V1.3.0

Fixed concurrency bug
Fixed Rotate regex bug
Changed the Resize method to accept a System.Drawing.Size
Changed the Rotate method to accept an
ImageProcessor.Imaging.RotateLayer
Reoganized project.


Former-commit-id: ba0d58b9897c2a6b5c308075503dbd17793ea7be
af/merge-core
James South 13 years ago
parent
commit
9408f6bf1e
  1. 64
      README.md
  2. 35
      src/ImageProcessor.Web/HttpModules/ImageProcessingModule.cs
  3. 42
      src/ImageProcessor.Web/ImageFactoryExtensions.cs
  4. 96
      src/ImageProcessor.Web/ImageProcessor.Web.vsdoc
  5. 6
      src/ImageProcessor.Web/Properties/AssemblyInfo.cs
  6. 8
      src/ImageProcessor.sln
  7. 5
      src/ImageProcessor/ImageFactory.cs
  8. 7
      src/ImageProcessor/ImageProcessor.sln.vsdoc
  9. 105
      src/ImageProcessor/ImageProcessor.vsdoc
  10. 2
      src/ImageProcessor/Processors/Rotate.cs
  11. 6
      src/ImageProcessor/Properties/AssemblyInfo.cs
  12. 1
      src/ImageProcessor/UpgradeLog.htm.REMOVED.git-id
  13. 20
      src/Test/Test.sln
  14. 22
      src/Test/Test/Content/style.css
  15. 3
      src/Test/Test/Test.csproj
  16. 137
      src/Test/Test/Views/Home/Index.cshtml
  17. 19
      src/Test/Test/Views/Shared/_Layout.cshtml
  18. 204
      src/Test/Test/Web.config
  19. 4
      src/Test/Test/packages.config

64
README.md

@ -1,20 +1,21 @@
ImageProcessor ImageProcessor
=============== ===============
ImageProcessor is a library for on the fly processing of image files using Asp.Net 4 written in c#. Imageprocessor is a lightweight library written in C# that allows you to manipulate images on-the-fly using ASP.NET 4.0.
The library architecture is highly extensible and allows for easy extension. It's fast, extensible, easy to use, comes bundled with some great features and is fully open source.
Core plugins at present include: Core plugins at present include:
- Resize - Resize
- Crop - Crop
- Quality (The quality to set the output for jpeg files)
- Filter (Image filters including sepia, greyscale, blackwhite, lomograph, comic)
- Vignette (Adds a vignette effect to images)
- Format (Sets the output format)
- Alpha (Sets opacity) - Alpha (Sets opacity)
- Filter (Image filters including sepia, greyscale, blackwhite, lomograph, polaroid, comic, gotham, hisatch, losatch)
- Watermark (Set a text watermark) - Watermark (Set a text watermark)
- Format (Sets the output format)
- Rotate (Rotate the image)
- Quality (The quality to set the output for jpeg files)
- Vignette (Adds a vignette effect to images)
The library consists of two binaries: **ImageProcessor.dll** and **ImageProcessor.Web.dll**. The library consists of two binaries: **ImageProcessor.dll** and **ImageProcessor.Web.dll**.
@ -24,9 +25,9 @@ e.g.
// Read a file and resize it. // Read a file and resize it.
byte[] photoBytes = File.ReadAllBytes(file); byte[] photoBytes = File.ReadAllBytes(file);
int quality = 90; int quality = 70;
ImageFormat format = ImageFormat.Jpeg; ImageFormat format = ImageFormat.Jpeg;
int thumbnailSize = 150; Size size = new Size(150, 0)
using (var inStream = new MemoryStream(photoBytes)) using (var inStream = new MemoryStream(photoBytes))
{ {
@ -34,9 +35,15 @@ e.g.
{ {
using (ImageFactory imageFactory = new ImageFactory()) using (ImageFactory imageFactory = new ImageFactory())
{ {
// Load, resize and save an image. // Load, resize, set the format and quality and save an image.
imageFactory.Load(inStream).Format(format).Quality(quality).Resize(thumbnailSize, 0).Save(outStream); imageFactory.Load(inStream)
.Resize(size)
.Format(format)
.Quality(quality)
.Save(outStream);
} }
// Do something with the stream.
} }
} }
@ -44,14 +51,18 @@ e.g.
Using the HttpModule requires no code writing at all. Just reference the binaries and add the relevant sections to the web.config Using the HttpModule requires no code writing at all. Just reference the binaries and add the relevant sections to the web.config
Image requests suffixed with QueryString parameters will then be processed and cached to the server allowing for easy and efficient parsing of following requests. Image requests suffixed with querystring parameters will then be processed and cached to the server allowing for easy and efficient parsing of following requests.
The parsing engine for the HttpModule is incredibly flexible and will **allow you to add querystring parameters in any order.** The parsing engine for the HttpModule is incredibly flexible and will **allow you to add querystring parameters in any order.**
Installation Installation
============ ============
Installation is simple. Download the zip file from the downloads section and copy the two binaries into your bin folder. Then copy the example configuration values from the `config.txt` into your `web.config` to enable the processor. A Nuget package will be created once I've read the manual to allow simpler installation in the future. Installation is simple. A Nuget package is available [here][1].
[1]: http://nuget.org/packages/ImageProcessor/
Alternatively you can download and build the project and reference the binaries. Then copy the example configuration values from the demo project into your `web.config` to enable the processor.
Usage Usage
===== =====
@ -144,10 +155,37 @@ Supported file format just now are:
- jpg - jpg
- bmp - bmp
- png - png
- gif - gif (requires full trust)
e.g. e.g.
<img src="/images.yourimage.jpg?format=gif" alt="your image as a gif"/> <img src="/images.yourimage.jpg?format=gif" alt="your image as a gif"/>
Rotate
======
Imageprocessor can rotate your images without clipping. You can also optionally fill the background color for image types without transparency.
e.g.
<img src="/images.yourimage.jpg?rotate=26" alt="your image rotated"/>
<img src="/images.yourimage.jpg?rotate=angle-54|bgcolor-fff" alt="your image rotated"/>
Quality
======
Whilst Imageprocessor delivers an excellent quality/filesize ratio it also allows you to change the quality of jpegs on-the-fly.
e.g.
<img src="/images.yourimage.jpg?quality=65" alt="your image at quality 30"/>
Vignette
======
Imageprocessor can also add a vignette effect to images.
e.g.
<img src="/images.yourimage.jpg?vignette=true" alt="your image vignetted"/>

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

@ -123,40 +123,35 @@ namespace ImageProcessor.Web.HttpModules
} }
// Process the image. // Process the image.
if (isRemote) using (ImageFactory imageFactory = new ImageFactory())
{ {
Uri uri = new Uri(path); if (isRemote)
RemoteFile remoteFile = new RemoteFile(uri, false);
using (MemoryStream memoryStream = new MemoryStream())
{ {
using (Stream responseStream = remoteFile.GetWebResponse().GetResponseStream()) Uri uri = new Uri(path);
RemoteFile remoteFile = new RemoteFile(uri, false);
using (MemoryStream memoryStream = new MemoryStream())
{ {
if (responseStream != null) using (Stream responseStream = remoteFile.GetWebResponse().GetResponseStream())
{ {
responseStream.CopyTo(memoryStream); if (responseStream != null)
// Process the image.
using (ImageFactory imageFactory = new ImageFactory())
{ {
responseStream.CopyTo(memoryStream);
imageFactory.Load(memoryStream) imageFactory.Load(memoryStream)
.AddQueryString(queryString) .AddQueryString(queryString)
.Format(ImageUtils.GetImageFormat(imageName)) .Format(ImageUtils.GetImageFormat(imageName))
.AutoProcess() .AutoProcess().Save(cachedPath);
.Save(cachedPath);
} }
} }
} }
} }
} else
else
{
using (ImageFactory imageFactory = new ImageFactory())
{ {
imageFactory.Load(fullPath).AutoProcess().Save(cachedPath); imageFactory.Load(fullPath).AutoProcess().Save(cachedPath);
} }
} }
// Add 1 to the counter // Add 1 to the counter
cachedImageCounter += 1; cachedImageCounter += 1;
@ -255,4 +250,4 @@ namespace ImageProcessor.Web.HttpModules
} }
#endregion #endregion
} }
} }

42
src/ImageProcessor.Web/ImageFactoryExtensions.cs

@ -24,6 +24,8 @@ namespace ImageProcessor.Web
/// </summary> /// </summary>
public static class ImageFactoryExtensions public static class ImageFactoryExtensions
{ {
private static readonly object SyncLock = new object();
/// <summary> /// <summary>
/// Auto processes image files based on any querystring parameters added to the image path. /// Auto processes image files based on any querystring parameters added to the image path.
/// </summary> /// </summary>
@ -38,42 +40,26 @@ namespace ImageProcessor.Web
{ {
if (factory.ShouldProcess) if (factory.ShouldProcess)
{ {
// Get a list of all graphics processors that have parsed and matched the querystring. // TODO: This is going to be a bottleneck for speed. Find a faster way.
List<IGraphicsProcessor> list = lock (SyncLock)
ImageProcessorConfig.Instance.GraphicsProcessors
.Where(x => x.MatchRegexIndex(factory.QueryString) != int.MaxValue)
.OrderBy(y => y.SortOrder)
.ToList();
// Loop through and process the image.
foreach (IGraphicsProcessor graphicsProcessor in list)
{ {
try // Get a list of all graphics processors that have parsed and matched the querystring.
{ List<IGraphicsProcessor> list =
// TODO: This is going to be a bottleneck for speed. Find a faster way. ImageProcessorConfig.Instance.GraphicsProcessors
IGraphicsProcessor processor = .Where(x => x.MatchRegexIndex(factory.QueryString) != int.MaxValue)
(IGraphicsProcessor)Activator.CreateInstance(graphicsProcessor.GetType()); .OrderBy(y => y.SortOrder)
// Get the dynamic parameter. .ToList();
processor.MatchRegexIndex(factory.QueryString);
// Process.
factory.Image = processor.ProcessImage(factory);
//// TODO: This is going to be a bottleneck for speed. Find a faster way. // Loop through and process the image.
//IGraphicsProcessor processor = foreach (IGraphicsProcessor graphicsProcessor in list)
// (IGraphicsProcessor)Activator.CreateInstance(graphicsProcessor.GetType());
//// Get the dynamic parameter.
//processor.MatchRegexIndex(factory.QueryString);
//// Process.
//factory.Image = processor.ProcessImage(factory);
}
catch (Exception ex)
{ {
throw ex; factory.Image = graphicsProcessor.ProcessImage(factory);
} }
} }
} }
return factory; return factory;
} }

96
src/ImageProcessor.Web/ImageProcessor.Web.vsdoc

@ -1,96 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!-- VSdocman config file for current project/solution.-->
<activeProfile>default</activeProfile>
<appSettings>
<add key="VBdocman_regexFilters"><![CDATA[<?xml version="1.0" encoding="utf-8"?>
<filters />]]></add>
<add key="VBdocman_comNonCommented"><![CDATA[-1]]></add>
<add key="VBdocman_comPublic"><![CDATA[-1]]></add>
<add key="VBdocman_comPrivate"><![CDATA[0]]></add>
<add key="VBdocman_comFriend"><![CDATA[0]]></add>
<add key="VBdocman_comProtected"><![CDATA[0]]></add>
<add key="VBdocman_comProtectedFriend"><![CDATA[0]]></add>
<add key="VBdocman_comMethod"><![CDATA[-1]]></add>
<add key="VBdocman_comStdModule"><![CDATA[0]]></add>
<add key="VBdocman_comObject"><![CDATA[-1]]></add>
<add key="VBdocman_comForm"><![CDATA[-1]]></add>
<add key="VBdocman_comProperty"><![CDATA[-1]]></add>
<add key="VBdocman_comEvent"><![CDATA[-1]]></add>
<add key="VBdocman_comVariable"><![CDATA[0]]></add>
<add key="VBdocman_comConstant"><![CDATA[0]]></add>
<add key="VBdocman_comEnumeration"><![CDATA[0]]></add>
<add key="VBdocman_comStructure"><![CDATA[0]]></add>
<add key="VBdocman_comDelegate"><![CDATA[0]]></add>
<add key="VBdocman_comInterface"><![CDATA[0]]></add>
<add key="VBdocman_comAttribute"><![CDATA[0]]></add>
<add key="VBdocman_comEventDecl"><![CDATA[0]]></add>
<add key="VBdocman_comDeclare"><![CDATA[0]]></add>
<add key="VBdocman_comContextID"><![CDATA[0]]></add>
<add key="VBdocman_comWriteDescription"><![CDATA[-1]]></add>
<add key="VBdocman_useConditionalCompilation"><![CDATA[0]]></add>
<add key="VBdocman_conditionalConstants"><![CDATA[]]></add>
<add key="VBdocman_showFormsSeparate"><![CDATA[0]]></add>
<add key="VBdocman_showInherited"><![CDATA[-1]]></add>
<add key="VBdocman_indentMode"><![CDATA[0]]></add>
<add key="VBdocman_insertSourceGlobal"><![CDATA[0]]></add>
<add key="VBdocman_unbreakSourceLines"><![CDATA[0]]></add>
<add key="VBdocman_removeAttributes"><![CDATA[0]]></add>
<add key="VBdocman_generateVbSyntax"><![CDATA[-1]]></add>
<add key="VBdocman_generateCsharpSyntax"><![CDATA[-1]]></add>
<add key="VBdocman_generateCppSyntax"><![CDATA[-1]]></add>
<add key="VBdocman_generateJscriptSyntax"><![CDATA[-1]]></add>
<add key="VBdocman_supportedPlatforms"><![CDATA[Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition]]></add>
<add key="VBdocman_supportedNetFramework"><![CDATA[3.0, 2.0, 1.1, 1.0]]></add>
<add key="VBdocman_supportedNetCompactFramework"><![CDATA[2.0, 1.0]]></add>
<add key="VBdocman_supportedXnaFramework"><![CDATA[1.0]]></add>
<add key="VBdocman_customVar1"><![CDATA[]]></add>
<add key="VBdocman_customVar2"><![CDATA[]]></add>
<add key="VBdocman_customVar3"><![CDATA[]]></add>
<add key="VBdocman_titlePageText"><![CDATA[]]></add>
<add key="VBdocman_rootNamespaceText"><![CDATA[]]></add>
<add key="VBdocman_rootNamespaceCommentStyle"><![CDATA[2]]></add>
<add key="VBdocman_pageFooterText"><![CDATA[Generated by VSdocman]]></add>
<add key="VBdocman_outputPath"><![CDATA[$(ProjectDir)VSdoc]]></add>
<add key="VBdocman_templateFolder"><![CDATA[$(VSdocmanDir)Templates]]></add>
<add key="VBdocman_externalFilesFolder"><![CDATA[]]></add>
<add key="VBdocman_fileNamingConvention"><![CDATA[1]]></add>
<add key="VBdocman_templateLocale"><![CDATA[en-US]]></add>
<add key="VBdocman_templatePath"><![CDATA[chm_msdn2.vbdt]]></add>
<add key="VBdocman_enumSorting"><![CDATA[1]]></add>
<add key="VBdocman_helpTitle"><![CDATA[ImageProcessor.Web Reference]]></add>
<add key="VBdocman_customTopics"><![CDATA[<?xml version="1.0" encoding="utf-8"?>
<topics>
<topic>
<type>normal</type>
<is-default>yes</is-default>
<name>ImageProcessor.Web Reference</name>
<id>imageprocessorweb_reference</id>
<comment><![CDATA[<summary></summary>vsdocman_escaped_]_]_></comment>
<namespaces />
<topics>
<topic>
<type>placeholder</type>
<is-default>no</is-default>
<name />
<id>d85a6fde0cd5454f9dc418dda28f5422</id>
<comment><![CDATA[vsdocman_escaped_]_]_></comment>
<namespaces />
<topics />
</topic>
</topics>
</topic>
</topics>]]></add>
<add key="VBdocman_linkForExternalNotInFramework"><![CDATA[0]]></add>
<add key="VBdocman_allowMacrosInComments"><![CDATA[0]]></add>
<add key="VBdocman_emptyOutputFolder"><![CDATA[0]]></add>
<add key="VBdocman_comModules_Caching...DiskCache.cs"><![CDATA[On]]></add>
<add key="VBdocman_comModules_Config...ImageCacheSection.cs"><![CDATA[On]]></add>
<add key="VBdocman_comModules_Config...ImageProcessingSection.cs"><![CDATA[On]]></add>
<add key="VBdocman_comModules_Config...ImageProcessorConfig.cs"><![CDATA[On]]></add>
<add key="VBdocman_comModules_Config...ImageSecuritySection.cs"><![CDATA[On]]></add>
<add key="VBdocman_comModules_Helpers...RemoteFile.cs"><![CDATA[On]]></add>
<add key="VBdocman_comModules_HttpModules...ImageProcessingModule.cs"><![CDATA[On]]></add>
<add key="VBdocman_comModules_Properties...AssemblyInfo.cs"><![CDATA[On]]></add>
</appSettings>
</configuration>

6
src/ImageProcessor.Web/Properties/AssemblyInfo.cs

@ -10,7 +10,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("James South")] [assembly: AssemblyConfiguration("James South")]
[assembly: AssemblyCompany("James South")] [assembly: AssemblyCompany("James South")]
[assembly: AssemblyProduct("ImageProcessor.Web")] [assembly: AssemblyProduct("ImageProcessor.Web")]
[assembly: AssemblyCopyright("Copyright ©")] [assembly: AssemblyCopyright("Copyright © James South")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// //
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("1.2.0.0")] [assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyFileVersion("1.3.0.0")]

8
src/ImageProcessor/ImageProcessor.sln → src/ImageProcessor.sln

@ -1,11 +1,11 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012 # Visual Studio Express 2012 for Web
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageProcessor", "ImageProcessor.csproj", "{3B5DD734-FB7A-487D-8CE6-55E7AF9AEA7E}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageProcessor", "ImageProcessor\ImageProcessor.csproj", "{3B5DD734-FB7A-487D-8CE6-55E7AF9AEA7E}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "..\Test\Test\Test.csproj", "{30327C08-7574-4D7E-AC95-6A58753C6855}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test\Test.csproj", "{30327C08-7574-4D7E-AC95-6A58753C6855}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageProcessor.Web", "..\ImageProcessor.Web\ImageProcessor.Web.csproj", "{4F7050F2-465F-4E10-8DB2-2FB97AC6AA43}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ImageProcessor.Web", "ImageProcessor.Web\ImageProcessor.Web.csproj", "{4F7050F2-465F-4E10-8DB2-2FB97AC6AA43}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution

5
src/ImageProcessor/ImageFactory.cs

@ -318,7 +318,7 @@ namespace ImageProcessor
/// Rotates the current image by the given angle. /// Rotates the current image by the given angle.
/// </summary> /// </summary>
/// <param name="rotateLayer"> /// <param name="rotateLayer">
/// The RotateLayer containing the properties to rotate the image. /// The <see cref="T:ImageProcessor.Imaging.RotateLayer"/> containing the properties to rotate the image.
/// </param> /// </param>
/// <returns> /// <returns>
/// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class. /// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class.
@ -363,7 +363,8 @@ namespace ImageProcessor
/// Adds a text based watermark to the image /// Adds a text based watermark to the image
/// </summary> /// </summary>
/// <param name="textLayer"> /// <param name="textLayer">
/// The text layer containing the properties necessary to add the text based watermark to the image. /// The <see cref="T:ImageProcessor.Imaging.TextLayer"/> containing the properties necessary to add
/// the text based watermark to the image.
/// </param> /// </param>
/// <returns> /// <returns>
/// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class. /// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class.

7
src/ImageProcessor/ImageProcessor.sln.vsdoc

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!-- VSdocman config file for current project/solution.-->
<activeProfile>default</activeProfile>
<appSettings>
</appSettings>
</configuration>

105
src/ImageProcessor/ImageProcessor.vsdoc

@ -1,105 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<!-- VSdocman config file for current project/solution.-->
<activeProfile>default</activeProfile>
<appSettings>
<add key="VBdocman_regexFilters"><![CDATA[<?xml version="1.0" encoding="utf-8"?>
<filters />]]></add>
<add key="VBdocman_comNonCommented"><![CDATA[-1]]></add>
<add key="VBdocman_comPublic"><![CDATA[-1]]></add>
<add key="VBdocman_comPrivate"><![CDATA[0]]></add>
<add key="VBdocman_comFriend"><![CDATA[0]]></add>
<add key="VBdocman_comProtected"><![CDATA[0]]></add>
<add key="VBdocman_comProtectedFriend"><![CDATA[0]]></add>
<add key="VBdocman_comMethod"><![CDATA[-1]]></add>
<add key="VBdocman_comStdModule"><![CDATA[0]]></add>
<add key="VBdocman_comObject"><![CDATA[-1]]></add>
<add key="VBdocman_comForm"><![CDATA[-1]]></add>
<add key="VBdocman_comProperty"><![CDATA[-1]]></add>
<add key="VBdocman_comEvent"><![CDATA[-1]]></add>
<add key="VBdocman_comVariable"><![CDATA[0]]></add>
<add key="VBdocman_comConstant"><![CDATA[0]]></add>
<add key="VBdocman_comEnumeration"><![CDATA[0]]></add>
<add key="VBdocman_comStructure"><![CDATA[0]]></add>
<add key="VBdocman_comDelegate"><![CDATA[0]]></add>
<add key="VBdocman_comInterface"><![CDATA[0]]></add>
<add key="VBdocman_comAttribute"><![CDATA[0]]></add>
<add key="VBdocman_comEventDecl"><![CDATA[0]]></add>
<add key="VBdocman_comDeclare"><![CDATA[0]]></add>
<add key="VBdocman_comContextID"><![CDATA[0]]></add>
<add key="VBdocman_comWriteDescription"><![CDATA[-1]]></add>
<add key="VBdocman_useConditionalCompilation"><![CDATA[0]]></add>
<add key="VBdocman_conditionalConstants"><![CDATA[]]></add>
<add key="VBdocman_showFormsSeparate"><![CDATA[0]]></add>
<add key="VBdocman_showInherited"><![CDATA[-1]]></add>
<add key="VBdocman_indentMode"><![CDATA[0]]></add>
<add key="VBdocman_insertSourceGlobal"><![CDATA[0]]></add>
<add key="VBdocman_unbreakSourceLines"><![CDATA[0]]></add>
<add key="VBdocman_removeAttributes"><![CDATA[0]]></add>
<add key="VBdocman_generateVbSyntax"><![CDATA[-1]]></add>
<add key="VBdocman_generateCsharpSyntax"><![CDATA[-1]]></add>
<add key="VBdocman_generateCppSyntax"><![CDATA[-1]]></add>
<add key="VBdocman_generateJscriptSyntax"><![CDATA[-1]]></add>
<add key="VBdocman_supportedPlatforms"><![CDATA[Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition]]></add>
<add key="VBdocman_supportedNetFramework"><![CDATA[3.0, 2.0, 1.1, 1.0]]></add>
<add key="VBdocman_supportedNetCompactFramework"><![CDATA[2.0, 1.0]]></add>
<add key="VBdocman_supportedXnaFramework"><![CDATA[1.0]]></add>
<add key="VBdocman_customVar1"><![CDATA[]]></add>
<add key="VBdocman_customVar2"><![CDATA[]]></add>
<add key="VBdocman_customVar3"><![CDATA[]]></add>
<add key="VBdocman_titlePageText"><![CDATA[]]></add>
<add key="VBdocman_rootNamespaceText"><![CDATA[]]></add>
<add key="VBdocman_rootNamespaceCommentStyle"><![CDATA[2]]></add>
<add key="VBdocman_pageFooterText"><![CDATA[Generated by VSdocman]]></add>
<add key="VBdocman_outputPath"><![CDATA[$(ProjectDir)VSdoc]]></add>
<add key="VBdocman_templateFolder"><![CDATA[$(VSdocmanDir)Templates]]></add>
<add key="VBdocman_externalFilesFolder"><![CDATA[]]></add>
<add key="VBdocman_fileNamingConvention"><![CDATA[1]]></add>
<add key="VBdocman_templateLocale"><![CDATA[en-US]]></add>
<add key="VBdocman_templatePath"><![CDATA[chm_msdn2.vbdt]]></add>
<add key="VBdocman_enumSorting"><![CDATA[1]]></add>
<add key="VBdocman_helpTitle"><![CDATA[ImageProcessor Reference]]></add>
<add key="VBdocman_customTopics"><![CDATA[<?xml version="1.0" encoding="utf-8"?>
<topics>
<topic>
<type>normal</type>
<is-default>yes</is-default>
<name>ImageProcessor Reference</name>
<id>imageprocessor_reference</id>
<comment><![CDATA[<summary></summary>vsdocman_escaped_]_]_></comment>
<namespaces />
<topics>
<topic>
<type>placeholder</type>
<is-default>no</is-default>
<name />
<id>e3cba20ec62e422b8bb39e6be7ca2142</id>
<comment><![CDATA[vsdocman_escaped_]_]_></comment>
<namespaces />
<topics />
</topic>
</topics>
</topic>
</topics>]]></add>
<add key="VBdocman_linkForExternalNotInFramework"><![CDATA[0]]></add>
<add key="VBdocman_allowMacrosInComments"><![CDATA[0]]></add>
<add key="VBdocman_emptyOutputFolder"><![CDATA[0]]></add>
<add key="VBdocman_comModules_Helpers...Extensions...EnumExtensions.cs"><![CDATA[On]]></add>
<add key="VBdocman_comModules_Helpers...Extensions...StringExtensions.cs"><![CDATA[On]]></add>
<add key="VBdocman_comModules_ImageFactory.cs"><![CDATA[On]]></add>
<add key="VBdocman_comModules_Imaging...ImageUtils.cs"><![CDATA[On]]></add>
<add key="VBdocman_comModules_Imaging...OctreeQuantizer.cs"><![CDATA[On]]></add>
<add key="VBdocman_comModules_Imaging...Quantizer.cs"><![CDATA[On]]></add>
<add key="VBdocman_comModules_Imaging...ResponseType.cs"><![CDATA[On]]></add>
<add key="VBdocman_comModules_Imaging...TextLayer.cs"><![CDATA[On]]></add>
<add key="VBdocman_comModules_Processors...Alpha.cs"><![CDATA[On]]></add>
<add key="VBdocman_comModules_Processors...Copy of Watermark.cs"><![CDATA[On]]></add>
<add key="VBdocman_comModules_Processors...Crop.cs"><![CDATA[On]]></add>
<add key="VBdocman_comModules_Processors...Filter.cs"><![CDATA[On]]></add>
<add key="VBdocman_comModules_Processors...Quality.cs"><![CDATA[On]]></add>
<add key="VBdocman_comModules_Processors...Resize.cs"><![CDATA[On]]></add>
<add key="VBdocman_comModules_Processors...Vignette.cs"><![CDATA[On]]></add>
<add key="VBdocman_comModules_Processors...Watermark.cs"><![CDATA[On]]></add>
<add key="VBdocman_comModules_Properties...AssemblyInfo.cs"><![CDATA[On]]></add>
</appSettings>
</configuration>

2
src/ImageProcessor/Processors/Rotate.cs

@ -24,7 +24,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(@"rotate=((?:3[0-5][0-9]|[12][0-9]{2}|[1-9][0-9]?)|angle-(?:3[0-5][0-9]|[12][0-9]{2}|[1-9][0-9]?)\|bgcolor=([0-9a-fA-F]{3}){1,2})", RegexOptions.Compiled); private static readonly Regex QueryRegex = new Regex(@"rotate=((?:3[0-5][0-9]|[12][0-9]{2}|[1-9][0-9]?)|angle-(?:3[0-5][0-9]|[12][0-9]{2}|[1-9][0-9]?)\|bgcolor-([0-9a-fA-F]{3}){1,2})", RegexOptions.Compiled);
/// <summary> /// <summary>
/// The regular expression to search strings for the angle attribute. /// The regular expression to search strings for the angle attribute.

6
src/ImageProcessor/Properties/AssemblyInfo.cs

@ -11,7 +11,7 @@ using System.Security;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("James South")] [assembly: AssemblyCompany("James South")]
[assembly: AssemblyProduct("ImageProcessor")] [assembly: AssemblyProduct("ImageProcessor")]
[assembly: AssemblyCopyright("Copyright ©")] [assembly: AssemblyCopyright("Copyright © James South")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@ -32,6 +32,6 @@ using System.Security;
// //
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
[assembly: AssemblyVersion("1.2.0.0")] [assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyFileVersion("1.3.0.0")]

1
src/ImageProcessor/UpgradeLog.htm.REMOVED.git-id

@ -1 +0,0 @@
41192c06780bda40794dac2731a4105f1efe0311

20
src/Test/Test.sln

@ -1,20 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Test", "Test\Test.csproj", "{30327C08-7574-4D7E-AC95-6A58753C6855}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{30327C08-7574-4D7E-AC95-6A58753C6855}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{30327C08-7574-4D7E-AC95-6A58753C6855}.Debug|Any CPU.Build.0 = Debug|Any CPU
{30327C08-7574-4D7E-AC95-6A58753C6855}.Release|Any CPU.ActiveCfg = Release|Any CPU
{30327C08-7574-4D7E-AC95-6A58753C6855}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

22
src/Test/Test/Content/style.css

@ -13,11 +13,29 @@ h1 {
font-size: 3em; font-size: 3em;
} }
section section {
padding-bottom: 1em;
margin-bottom: 2em;
}
section section:nth-child(2n) {
color: #fff;
}
section section:nth-child(2) {
background-color: #00a9ec;
}
section section:nth-child(4) {
background-color: #ED1C24;
}
img { img {
background: #fff; /*background: #fff;
padding: 3px; padding: 3px;
-webkit-box-shadow: 0 0 5px rgb(0, 0, 0, 0.4); -webkit-box-shadow: 0 0 5px rgb(0, 0, 0, 0.4);
box-shadow: 0 0 5px rgb(0, 0, 0, 0.4); box-shadow: 0 0 5px rgb(0, 0, 0, 0.4);*/
} }
.no-bullets { .no-bullets {

3
src/Test/Test/Test.csproj

@ -117,9 +117,6 @@
<Folder Include="App_Data\" /> <Folder Include="App_Data\" />
<Folder Include="Models\" /> <Folder Include="Models\" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Content Include="packages.config" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\ImageProcessor.Web\ImageProcessor.Web.csproj"> <ProjectReference Include="..\..\ImageProcessor.Web\ImageProcessor.Web.csproj">
<Project>{4F7050F2-465F-4E10-8DB2-2FB97AC6AA43}</Project> <Project>{4F7050F2-465F-4E10-8DB2-2FB97AC6AA43}</Project>

137
src/Test/Test/Views/Home/Index.cshtml

@ -1,57 +1,94 @@
@{ @{
ViewBag.Title = "Home Page"; ViewBag.Title = "Home Page";
} }
<section class="row"> <section>
@* <div class="clmn2"> <div class="container">
<h2>Resized Image</h2> <div class="clmn2">
<img src="/images/Penguins.jpg?width=300" /> <h2>Resized</h2>
<img src="/images/Penguins.jpg?width=300" />
</div>
<div class="clmn2">
<h2>Cropped </h2>
<img src="/images/Penguins.jpg?crop=0-0-300-225" />
</div>
</div>
</section>
<section>
<div class="container">
<h2>Filter</h2>
<ul class="no-bullets clearfix">
<li>
<h3>blackwhite</h3>
<img src="/images/Penguins.jpg?width=300&filter=blackwhite" />
</li>
<li>
<h3>comic</h3>
<img src="/images/Penguins.jpg?width=300&filter=comic" />
</li>
<li>
<h3>lomograph</h3>
<img src="/images/Penguins.jpg?width=300&filter=lomograph" />
</li>
<li>
<h3>greyscale</h3>
<img src="/images/Penguins.jpg?width=300&filter=greyscale" />
</li>
<li>
<h3>polaroid</h3>
<img src="/images/Penguins.jpg?width=300&filter=polaroid" />
</li>
<li>
<h3>sepia</h3>
<img src="/images/Penguins.jpg?width=300&filter=sepia" />
</li>
<li>
<h3>gotham</h3>
<img src="/images/Penguins.jpg?width=300&filter=gotham" />
</li>
<li>
<h3>hisatch</h3>
<img src="/images/Penguins.jpg?width=300&filter=hisatch" />
</li>
<li>
<h3>losatch</h3>
<img src="/images/Penguins.jpg?width=300&filter=losatch" />
</li>
</ul>
</div> </div>
<div class="clmn2">
<h2>Cropped Image</h2>
<img src="/images/Penguins.jpg?crop=0-0-300-225" />
</div>*@
</section> </section>
<section> <section>
<h2>Filtered Image</h2> <div class="container">
<ul class="no-bullets clearfix"> <div class="clmn2">
<li> <h2>Watermark</h2>
<h3>blackwhite</h3> <img src="/images/Penguins.jpg?width=300&watermark=text-test|color-fff|size-48|style-italic|opacity-100|position-100-100|shadow-true|font-arial" />
<img src="/images/Penguins.jpg?width=300&filter=blackwhite" /> </div>
</li> <div class="clmn2">
<li> <h2>Format</h2>
<h3>comic</h3> <img src="/images/Penguins.jpg?width=300&format=gif" />
<img src="/images/Penguins.jpg?width=300&filter=comic" /> </div>
</li> </div>
<li> </section>
<h3>lomograph</h3> <section>
<img src="/images/Penguins.jpg?width=300&filter=lomograph" /> <div class="container">
</li> <div class="clmn2">
@* <li> <h2>Rotate</h2>
<h3>greyscale</h3> <img src="/images/Penguins.jpg?width=300&rotate=angle-54|bgcolor-fff" />
<img src="/images/Penguins.jpg?width=300&filter=greyscale" /> </div>
</li> <div class="clmn2">
<li> <h2>Quality</h2>
<h3>polaroid</h3> <img src="/images/Penguins.jpg?width=300&quality=5" />
<img src="/images/Penguins.jpg?width=300&filter=polaroid" /> </div>
</li> </div>
<li> </section>
<h3>sepia</h3> <section>
<img src="/images/Penguins.jpg?width=300&filter=sepia" /> <div class="container">
</li> <div class="clmn2">
<li> <h2>Alpha</h2>
<h3>gotham</h3> <img src="/images/Penguins.jpg?width=300&format=png&alpha=50" />
<img src="/images/Penguins.jpg?width=300&filter=gotham" /> </div>
</li> <div class="clmn2">
<li> <h2>Remote</h2>
<h3>hisatch</h3> <img src="/remote.axd?http://images.mymovies.net/images/film/cin/500x377/fid11707.jpg?width=300" />
<img src="/images/Penguins.jpg?width=300&filter=hisatch" /> </div>
</li> </div>
<li>
<h3>losatch</h3>
<img src="/images/Penguins.jpg?width=300&filter=losatch" />
</li>*@
</ul>
</section> </section>
@*<h3>Remote image test</h3>
<img src="/remote.axd?http://images.mymovies.net/images/film/cin/500x377/fid11707.jpg?width=200" />*@

19
src/Test/Test/Views/Shared/_Layout.cshtml

@ -8,17 +8,16 @@
</head> </head>
<body> <body>
<div class="page"> <div class="page">
<div class="container"> <header>
<header> <div class="container">
<div> <h1>ImageProcessor Test Website</h1>
<h1>ImageProcessor Test Website</h1> </div>
</div> </header>
</header> <section id="main">
<section id="main"> @RenderBody()
@RenderBody() </section>
</section>
</div>
</div> </div>
<footer class="page-footer"> <footer class="page-footer">
</footer> </footer>
</body> </body>

204
src/Test/Test/Web.config

@ -1,117 +1,87 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!-- <!--
For more information on how to configure your ASP.NET application, please visit For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=152368 http://go.microsoft.com/fwlink/?LinkId=152368
--> -->
<configuration> <configuration>
<!-- Configuration section-handler declaration area. --> <!-- Configuration section-handler declaration area. -->
<configSections> <configSections>
<sectionGroup name="imageProcessor"> <sectionGroup name="imageProcessor">
<section name="security" requirePermission="false" type="ImageProcessor.Web.Config.ImageSecuritySection, ImageProcessor.Web"/> <section name="security" requirePermission="false" type="ImageProcessor.Web.Config.ImageSecuritySection, ImageProcessor.Web"/>
<section name="processing" requirePermission="false" type="ImageProcessor.Web.Config.ImageProcessingSection, ImageProcessor.Web" /> <section name="processing" requirePermission="false" type="ImageProcessor.Web.Config.ImageProcessingSection, ImageProcessor.Web" />
<section name="cache" requirePermission="false" type="ImageProcessor.Web.Config.ImageCacheSection, ImageProcessor.Web" /> <section name="cache" requirePermission="false" type="ImageProcessor.Web.Config.ImageCacheSection, ImageProcessor.Web" />
</sectionGroup> </sectionGroup>
</configSections> </configSections>
<connectionStrings>
<add name="ApplicationServices" <appSettings>
connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" <add key="webpages:Version" value="1.0.0.0"/>
providerName="System.Data.SqlClient" /> <add key="ClientValidationEnabled" value="true"/>
</connectionStrings> <add key="UnobtrusiveJavaScriptEnabled" value="true"/>
</appSettings>
<appSettings>
<add key="webpages:Version" value="1.0.0.0"/> <system.web>
<add key="ClientValidationEnabled" value="true"/> <compilation debug="true" targetFramework="4.0">
<add key="UnobtrusiveJavaScriptEnabled" value="true"/> <assemblies>
</appSettings> <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<system.web> <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<compilation debug="true" targetFramework="4.0"> <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<assemblies> <add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> </assemblies>
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> </compilation>
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <authentication mode="Forms">
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <forms loginUrl="~/Account/LogOn" timeout="2880" />
</assemblies> </authentication>
</compilation>
<pages>
<authentication mode="Forms"> <namespaces>
<forms loginUrl="~/Account/LogOn" timeout="2880" /> <add namespace="System.Web.Helpers" />
</authentication> <add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<membership> <add namespace="System.Web.Mvc.Html" />
<providers> <add namespace="System.Web.Routing" />
<clear/> <add namespace="System.Web.WebPages"/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" </namespaces>
enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" </pages>
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" <httpModules>
applicationName="/" /> <add name="ImageProcessorModule" type="ImageProcessor.Web.HttpModules.ImageProcessingModule, ImageProcessor.Web"/>
</providers> </httpModules>
</membership> <!--Set the trust level.-->
<!--<trust level="Medium"/>-->
<profile> </system.web>
<providers>
<clear/> <system.webServer>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" /> <validation validateIntegratedModeConfiguration="false"/>
</providers> <modules runAllManagedModulesForAllRequests="true"/>
</profile> </system.webServer>
<roleManager enabled="false"> <runtime>
<providers> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<clear/> <dependentAssembly>
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" /> <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" /> <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
</providers> </dependentAssembly>
</roleManager> </assemblyBinding>
</runtime>
<pages>
<namespaces> <imageProcessor>
<add namespace="System.Web.Helpers" /> <security allowRemoteDownloads="true" timeout="300000" maxBytes="524288" remotePrefix="/remote.axd">
<add namespace="System.Web.Mvc" /> <whiteList>
<add namespace="System.Web.Mvc.Ajax" /> <add url="http://images.mymovies.net"/>
<add namespace="System.Web.Mvc.Html" /> </whiteList>
<add namespace="System.Web.Routing" /> </security>
<add namespace="System.Web.WebPages"/> <cache virtualPath="~/cache" maxDays="365" />
</namespaces> <processing>
</pages> <plugins>
<httpModules> <plugin name ="Resize">
<add name="ImageProcessorModule" type="ImageProcessor.Web.HttpModules.ImageProcessingModule, ImageProcessor.Web"/> <settings>
</httpModules> <setting key="MaxWidth" value="1024"/>
<!--Set the trust level.--> <setting key="MaxHeight" value="768"/>
<!--<trust level="Medium"/>--> </settings>
</system.web> </plugin>
</plugins>
<system.webServer> </processing>
<validation validateIntegratedModeConfiguration="false"/> </imageProcessor>
<modules runAllManagedModulesForAllRequests="true"/> </configuration>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<imageProcessor>
<security allowRemoteDownloads="true" timeout="300000" maxBytes="524288" remotePrefix="/remote.axd">
<whiteList>
<add url="http://images.mymovies.net"/>
</whiteList>
</security>
<cache virtualPath="~/cache" maxDays="7" />
<processing>
<plugins>
<plugin name ="Resize">
<settings>
<setting key="MaxWidth" value="1024"/>
<setting key="MaxHeight" value="768"/>
</settings>
</plugin>
</plugins>
</processing>
</imageProcessor>
</configuration>

4
src/Test/Test/packages.config

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="EntityFramework" version="4.1.10331.0" />
</packages>
Loading…
Cancel
Save