Browse Source

v2.1.2.0

Former-commit-id: 56fdeb5dcbc3ccb27edd8167aa8f6a62f62f23c5
af/merge-core
JimBobSquarePants 13 years ago
parent
commit
7c981498af
  1. 6
      src/ImageProcessor.Tests/RegularExpressionUnitTests.cs
  2. 2
      src/ImageProcessor.Web/Caching/DiskCache.cs
  3. 4
      src/ImageProcessor.Web/Properties/AssemblyInfo.cs
  4. 20
      src/ImageProcessor/ImageFactory.cs
  5. 28
      src/ImageProcessor/Imaging/RotateLayer.cs
  6. 2
      src/ImageProcessor/Imaging/TextLayer.cs
  7. 7
      src/ImageProcessor/Processors/Rotate.cs
  8. 4
      src/ImageProcessor/Properties/AssemblyInfo.cs
  9. BIN
      src/Nuget/ImageProcessor.1.5.0.0.nupkg
  10. 1
      src/Nuget/ImageProcessor.Web.2.1.2.0.nupkg.REMOVED.git-id
  11. 66
      src/Test/Test/Controllers/HomeController.cs
  12. 3
      src/Test/Test/Resized/240px_228406_276791782435436_815038966_n.jpg
  13. 3
      src/Test/Test/Resized/240px_MSwanson - Wide Large - Rock 02.jpg
  14. 3
      src/Test/Test/Resized/240px_Neck2-1.jpg
  15. 3
      src/Test/Test/Resized/320px_228406_276791782435436_815038966_n.jpg
  16. 3
      src/Test/Test/Resized/320px_MSwanson - Wide Large - Rock 02.jpg
  17. 3
      src/Test/Test/Resized/320px_Neck2-1.jpg
  18. 3
      src/Test/Test/Resized/460px_228406_276791782435436_815038966_n.jpg
  19. 3
      src/Test/Test/Resized/460px_MSwanson - Wide Large - Rock 02.jpg
  20. 3
      src/Test/Test/Resized/460px_Neck2-1.jpg
  21. 3
      src/Test/Test/Test.csproj
  22. 5
      src/Test/Test/Views/Home/Upload.cshtml
  23. 160
      src/Test/Test/Web.config

6
src/ImageProcessor.Tests/RegularExpressionUnitTests.cs

@ -132,11 +132,7 @@ namespace ImageProcessor.Tests
public void TestRotateRegex()
{
const string Querystring = "rotate=270";
RotateLayer expected = new RotateLayer
{
Angle = 270,
BackgroundColor = Color.Transparent
};
RotateLayer expected = new RotateLayer(270, Color.Transparent);
Rotate rotate = new Rotate();
rotate.MatchRegexIndex(Querystring);

2
src/ImageProcessor.Web/Caching/DiskCache.cs

@ -304,7 +304,7 @@ namespace ImageProcessor.Web.Caching
/// </returns>
internal async Task<DateTime> SetCachedLastWriteTimeAsync()
{
// Create Action delegate for IsNewOrUpdatedFile.
// Create Action delegate for SetCachedLastWriteTime.
return await TaskHelpers.Run(() => this.SetCachedLastWriteTime());
}

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

@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("2.1.1.0")]
[assembly: AssemblyFileVersion("2.1.1.0")]
[assembly: AssemblyVersion("2.1.2.0")]
[assembly: AssemblyFileVersion("2.1.2.0")]

20
src/ImageProcessor/ImageFactory.cs

@ -184,7 +184,7 @@ namespace ImageProcessor
}
/// <summary>
/// Resets the ImageFactory to its original loaded state.
/// Resets the current image to its original loaded state.
/// </summary>
/// <returns>
/// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class.
@ -213,7 +213,6 @@ namespace ImageProcessor
return this;
}
#region Manipulation
/// <summary>
/// Adds a query-string to the image factory to allow auto-processing of remote files.
@ -317,7 +316,7 @@ namespace ImageProcessor
}
/// <summary>
/// Crops an image to the given coordinates.
/// Crops the current image to the given location and size.
/// </summary>
/// <param name="rectangle">
/// The <see cref="T:System.Drawing.Rectangle"/> containing the coordinates to crop the image to.
@ -338,7 +337,7 @@ namespace ImageProcessor
}
/// <summary>
/// Applies a filter to an image.
/// Applies a filter to the current image.
/// </summary>
/// <param name="filterName">
/// The name of the filter to add to the image.
@ -359,7 +358,7 @@ namespace ImageProcessor
}
/// <summary>
/// Flips an image either horizontally or vertically.
/// Flips the current image either horizontally or vertically.
/// </summary>
/// <param name="flipVertically">
/// Whether to flip the image vertically.
@ -384,7 +383,7 @@ namespace ImageProcessor
}
/// <summary>
/// Sets the output format of the image to the matching <see cref="T:System.Drawing.Imaging.ImageFormat"/>.
/// Sets the output format of the current image to the matching <see cref="T:System.Drawing.Imaging.ImageFormat"/>.
/// </summary>
/// <param name="imageFormat">The <see cref="T:System.Drawing.Imaging.ImageFormat"/>. to set the image to.</param>
/// <returns>
@ -401,7 +400,10 @@ namespace ImageProcessor
}
/// <summary>
/// Applies a filter to an image.
/// Alters the output quality of the current image.
/// <remarks>
/// This method will only effect the output quality of jpeg images
/// </remarks>
/// </summary>
/// <param name="percentage">A value between 1 and 100 to set the quality to.</param>
/// <returns>
@ -418,7 +420,7 @@ namespace ImageProcessor
}
/// <summary>
/// Resizes an image to the given dimensions.
/// Resizes the current image to the given dimensions.
/// </summary>
/// <param name="size">
/// The <see cref="T:System.Drawing.Size"/> containing the width and height to set the image to.
@ -517,7 +519,7 @@ namespace ImageProcessor
}
/// <summary>
/// Adds a text based watermark to the image
/// Adds a text based watermark to the current image.
/// </summary>
/// <param name="textLayer">
/// The <see cref="T:ImageProcessor.Imaging.TextLayer"/> containing the properties necessary to add

28
src/ImageProcessor/Imaging/RotateLayer.cs

@ -26,6 +26,34 @@ namespace ImageProcessor.Imaging
{
this.BackgroundColor = Color.Transparent;
}
/// <summary>
/// Initializes a new instance of the <see cref="RotateLayer"/> class.
/// </summary>
/// <param name="angle">
/// The angle at which to rotate the image.
/// </param>
public RotateLayer(int angle)
{
this.Angle = angle;
this.BackgroundColor = Color.Transparent;
}
/// <summary>
/// Initializes a new instance of the <see cref="RotateLayer"/> class.
/// </summary>
/// <param name="angle">
/// The angle at which to rotate the image.
/// </param>
/// <param name="backgroundColor">
/// The <see cref="T:System.Drawing.Color"/> to set as the background color.
/// <remarks>Used for image formats that do not support transparency</remarks>
/// </param>
public RotateLayer(int angle, Color backgroundColor)
{
this.Angle = angle;
this.BackgroundColor = backgroundColor;
}
#endregion
#region Properties

2
src/ImageProcessor/Imaging/TextLayer.cs

@ -14,7 +14,7 @@ namespace ImageProcessor.Imaging
#endregion
/// <summary>
/// Enacapsulates the properties required to add a layer of text to an image.
/// Encapsulates the properties required to add a layer of text to an image.
/// </summary>
public class TextLayer
{

7
src/ImageProcessor/Processors/Rotate.cs

@ -100,21 +100,20 @@ namespace ImageProcessor.Processors
// Set the index on the first instance only.
this.SortOrder = match.Index;
RotateLayer rotateLayer = new RotateLayer();
RotateLayer rotateLayer;
string toParse = match.Value;
if (toParse.Contains("bgcolor"))
{
rotateLayer.Angle = this.ParseAngle(toParse);
rotateLayer.BackgroundColor = this.ParseColor(toParse);
rotateLayer = new RotateLayer(this.ParseAngle(toParse), this.ParseColor(toParse));
}
else
{
int degrees;
int.TryParse(match.Value.Split('=')[1], out degrees);
rotateLayer.Angle = degrees;
rotateLayer = new RotateLayer(degrees);
}
this.DynamicParameter = rotateLayer;

4
src/ImageProcessor/Properties/AssemblyInfo.cs

@ -32,6 +32,6 @@ using System.Security;
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.4.2.0")]
[assembly: AssemblyFileVersion("1.4.2.0")]
[assembly: AssemblyVersion("1.5.0.0")]
[assembly: AssemblyFileVersion("1.5.0.0")]

BIN
src/Nuget/ImageProcessor.1.5.0.0.nupkg

Binary file not shown.

1
src/Nuget/ImageProcessor.Web.2.1.2.0.nupkg.REMOVED.git-id

@ -0,0 +1 @@
1ac41e14e3ae5f8ac9b06bcfbbacc6c4a9841863

66
src/Test/Test/Controllers/HomeController.cs

@ -6,11 +6,16 @@ using System.Web.Mvc;
namespace Test.Controllers
{
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Threading.Tasks;
using System.Web.Hosting;
using ImageProcessor;
using ImageProcessor.Helpers.Extensions;
using ImageProcessor.Imaging;
//using ImageProcessor.Web.Caching;
public class HomeController : Controller
@ -22,6 +27,67 @@ namespace Test.Controllers
return View();
}
public ActionResult Upload()
{
return View();
}
[HttpPost]
public ActionResult Upload(HttpPostedFileBase file)
{
Stream upload = file.InputStream;
int quality = 70;
ImageFormat format = ImageFormat.Jpeg;
Size size460 = new Size(460, 0);
Size size320 = new Size(320, 0);
Size size240 = new Size(240, 0);
// Make sure the directory exists as Image.Save will not work without an existing directory.
string outputPath = HostingEnvironment.MapPath("~/Resized");
if (outputPath != null)
{
DirectoryInfo directoryInfo = new DirectoryInfo(outputPath);
if (!directoryInfo.Exists)
{
directoryInfo.Create();
}
// Make the three file paths
string outputfile1 = Path.Combine(outputPath, "460px_" + file.FileName);
string outputfile2 = Path.Combine(outputPath, "320px_" + file.FileName);
string outputfile3 = Path.Combine(outputPath, "240px_" + file.FileName);
using (MemoryStream inStream = new MemoryStream())
{
// Copy the stream across.
upload.CopyTo(inStream);
using (ImageFactory imageFactory = new ImageFactory())
{
// Load, resize, set the format and quality and save an image.
imageFactory.Load(inStream)
.Format(format)
.Quality(quality)
.Resize(size460)
.Save(outputfile1)
.Reset()
.Format(format)
.Quality(quality)
.Resize(size320)
.Save(outputfile2)
.Reset()
.Format(format)
.Quality(quality)
.Resize(size240)
.Save(outputfile3);
}
}
}
return View();
}
public ActionResult About()
{
List<string> images = new List<string>();

3
src/Test/Test/Resized/240px_228406_276791782435436_815038966_n.jpg

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ea75dd804dbc2685d2189f9e5fba063427416cc3c024f9962ab10b8efc1471b0
size 17302

3
src/Test/Test/Resized/240px_MSwanson - Wide Large - Rock 02.jpg

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:bc4e1cd326a27789dfa3ad493b25611f31133f733e193e3eb5b4f8bc14429d1f
size 16510

3
src/Test/Test/Resized/240px_Neck2-1.jpg

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2633b42dfcd1b253ae2733d854a8801bd8ed547157dbcb148c529a3f2e213298
size 25044

3
src/Test/Test/Resized/320px_228406_276791782435436_815038966_n.jpg

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:38e73ab2ad96ab405755b53559490954f5eb6fb2bedffa2b619cfd5369f66998
size 28894

3
src/Test/Test/Resized/320px_MSwanson - Wide Large - Rock 02.jpg

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:319b3e4178951cabacd28dfee025f076e69e2c789d8a193236912a907083826c
size 27223

3
src/Test/Test/Resized/320px_Neck2-1.jpg

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5b203a58a268c47fce91ef419f996ef175d5a87f967ac2cc7978fb07bb7906da
size 39920

3
src/Test/Test/Resized/460px_228406_276791782435436_815038966_n.jpg

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0b50ba1e1003fcd44917f594081a3d4007ccbb65a2bd51e78de89c3ed413f301
size 57565

3
src/Test/Test/Resized/460px_MSwanson - Wide Large - Rock 02.jpg

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:24861d2f61cb23d5bd2ad01740a1086a0623bbc1b4ed35f04bda24b345b5c62a
size 28858

3
src/Test/Test/Resized/460px_Neck2-1.jpg

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fca1fdc26920f19d9ee821975afd3640e25208993055e75d0118b29ba4c1f2d6
size 41399

3
src/Test/Test/Test.csproj

@ -136,6 +136,9 @@
<ItemGroup>
<Content Include="Views\Home\Collisions.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\Home\Upload.cshtml" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>

5
src/Test/Test/Views/Home/Upload.cshtml

@ -0,0 +1,5 @@
@using (Html.BeginForm("Upload", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<input type="file" name="file" />
<button type="submit">Upload</button>
}

160
src/Test/Test/Web.config

@ -4,84 +4,84 @@
http://go.microsoft.com/fwlink/?LinkId=152368
-->
<configuration>
<!-- Configuration section-handler declaration area. -->
<configSections>
<sectionGroup name="imageProcessor">
<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="cache" requirePermission="false" type="ImageProcessor.Web.Config.ImageCacheSection, ImageProcessor.Web" />
</sectionGroup>
</configSections>
<appSettings>
<add key="webpages:Version" value="1.0.0.0" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<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" />
<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" />
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
<httpModules>
<add name="ImageProcessorModule" type="ImageProcessor.Web.HttpModules.ImageProcessingModule, ImageProcessor.Web" />
</httpModules>
<!--Set the trust level.-->
<!--<trust level="Medium"/>-->
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
<runtime>
<assemblyBinding xmlns:bcl="urn:schemas-microsoft-com:bcl" 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>
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.5.16.0" newVersion="2.5.16.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.5.16.0" newVersion="2.5.16.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="56" />
<processing>
<plugins>
<plugin name="Resize">
<settings>
<setting key="MaxWidth" value="1024" />
<setting key="MaxHeight" value="768" />
</settings>
</plugin>
</plugins>
</processing>
</imageProcessor>
<!-- Configuration section-handler declaration area. -->
<configSections>
<sectionGroup name="imageProcessor">
<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="cache" requirePermission="false" type="ImageProcessor.Web.Config.ImageCacheSection, ImageProcessor.Web" />
</sectionGroup>
</configSections>
<appSettings>
<add key="webpages:Version" value="1.0.0.0" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<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" />
<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" />
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</assemblies>
</compilation>
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
<pages>
<namespaces>
<add namespace="System.Web.Helpers" />
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
</namespaces>
</pages>
<httpModules>
<add name="ImageProcessorModule" type="ImageProcessor.Web.HttpModules.ImageProcessingModule, ImageProcessor.Web" />
</httpModules>
<!--Set the trust level.-->
<!--<trust level="Medium"/>-->
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
</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>
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.5.16.0" newVersion="2.5.16.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Threading.Tasks" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.5.16.0" newVersion="2.5.16.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="56" />
<processing>
<plugins>
<plugin name="Resize">
<settings>
<setting key="MaxWidth" value="1024" />
<setting key="MaxHeight" value="768" />
</settings>
</plugin>
</plugins>
</processing>
</imageProcessor>
</configuration>
Loading…
Cancel
Save