Browse Source

v 4.1.1.0

Former-commit-id: 2f6b172392cb9955180ac153d260eb4cb4441442
Former-commit-id: 70f6be3cd0a97a828907f2d26f5e49d989e2b773
pull/17/head
James South 11 years ago
parent
commit
269cf6a2ae
  1. 48
      build/NuSpecs/ImageProcessor.Plugins.Cair.nuspec
  2. 50
      build/NuSpecs/ImageProcessor.Plugins.WebP.nuspec
  3. 56
      build/NuSpecs/ImageProcessor.Web.Config.nuspec
  4. 50
      build/NuSpecs/ImageProcessor.Web.nuspec
  5. 40
      build/NuSpecs/ImageProcessor.nuspec
  6. 2
      build/build.xml
  7. 7
      src/ImageProcessor.Web/Configuration/ImageProcessorConfiguration.cs
  8. 34
      src/ImageProcessor.Web/HttpModules/ImageProcessingModule.cs
  9. 4
      src/ImageProcessor.Web/Properties/AssemblyInfo.cs
  10. 130
      src/TestWebsites/MVC/TestImageService.cs
  11. 1
      src/TestWebsites/MVC/Test_Website_MVC.csproj

48
build/NuSpecs/ImageProcessor.Plugins.Cair.nuspec

@ -1,31 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>ImageProcessor.Plugins.Cair</id>
<version>1.0.0.0</version>
<title>ImageProcessor.Plugins.Cair</title>
<authors>James South</authors>
<owners>James South</owners>
<projectUrl>http://imageprocessor.org</projectUrl>
<iconUrl>http://imageprocessor.org/assets/ico/apple-touch-icon-144x144.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Adds support to ImageProcessor for Content Aware Image Resizing.
<metadata>
<id>ImageProcessor.Plugins.Cair</id>
<version>1.0.0.0</version>
<title>ImageProcessor.Plugins.Cair</title>
<authors>James South</authors>
<owners>James South</owners>
<projectUrl>http://imageprocessor.org</projectUrl>
<iconUrl>http://imageprocessor.org/assets/ico/apple-touch-icon-144x144.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Adds support to ImageProcessor for Content Aware Image Resizing.
If you use ImageProcessor please get in touch via my twitter @james_m_south
Feedback is always welcome</description>
<summary>Adds support to ImageProcessor for Content Aware Image Resizing.</summary>
<releaseNotes />
<copyright>James South</copyright>
<language>en-GB</language>
<tags>Image Resize Crop Rotate Quality Watermark Gif Jpg Jpeg Bitmap Png Tiff Cair Seam Carving</tags>
<dependencies>
<group targetFramework=".NETFramework4.5">
<dependency id="ImageProcessor" version="2.0.0.0" />
</group>
</dependencies>
</metadata>
<files>
<file src="..\_BuildOutput\ImageProcessor.Plugins.Cair\lib\net45\ImageProcessor.Plugins.Cair.dll" target="lib\net45\ImageProcessor.Plugins.Cair.dll" />
</files>
<summary>Adds support to ImageProcessor for Content Aware Image Resizing.</summary>
<releaseNotes />
<copyright>James South</copyright>
<language>en-GB</language>
<tags>Image Resize Crop Rotate Quality Watermark Gif Jpg Jpeg Bitmap Png Tiff Cair Seam Carving</tags>
<dependencies>
<group targetFramework=".NETFramework4.5">
<dependency id="ImageProcessor" version="2.0.0.0" />
</group>
</dependencies>
</metadata>
<files>
<file src="..\_BuildOutput\ImageProcessor.Plugins.Cair\lib\net45\ImageProcessor.Plugins.Cair.dll" target="lib\net45\ImageProcessor.Plugins.Cair.dll" />
</files>
</package>

50
build/NuSpecs/ImageProcessor.Plugins.WebP.nuspec

@ -1,32 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>ImageProcessor.Plugins.WebP</id>
<version>1.0.1.0</version>
<title>ImageProcessor.Plugins.WebP</title>
<authors>James South</authors>
<owners>James South</owners>
<projectUrl>http://imageprocessor.org</projectUrl>
<iconUrl>http://imageprocessor.org/assets/ico/apple-touch-icon-144x144.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Adds support to ImageProcessor for the WebP image format.
<metadata>
<id>ImageProcessor.Plugins.WebP</id>
<version>1.0.1.0</version>
<title>ImageProcessor.Plugins.WebP</title>
<authors>James South</authors>
<owners>James South</owners>
<projectUrl>http://imageprocessor.org</projectUrl>
<iconUrl>http://imageprocessor.org/assets/ico/apple-touch-icon-144x144.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Adds support to ImageProcessor for the WebP image format.
If you use ImageProcessor please get in touch via my twitter @james_m_south
Feedback is always welcome</description>
<summary>Adds support to ImageProcessor and ImageProcessor.Web for the WebP image format.</summary>
<releaseNotes />
<copyright>James South</copyright>
<language>en-GB</language>
<tags>Image Resize Crop Rotate Quality Watermark Gif Jpg Jpeg Bitmap Png Tiff WebP</tags>
<dependencies>
<group targetFramework=".NETFramework4.5">
<dependency id="ImageProcessor" version="2.0.0.0" />
</group>
</dependencies>
</metadata>
<files>
<file src="..\content\ImageProcessor.Plugins.WebP\web.config.transform" target="content\web.config.transform" />
<file src="..\_BuildOutput\ImageProcessor.Plugins.WebP\lib\net45\ImageProcessor.Plugins.WebP.dll" target="lib\net45\ImageProcessor.Plugins.WebP.dll" />
</files>
<summary>Adds support to ImageProcessor and ImageProcessor.Web for the WebP image format.</summary>
<releaseNotes />
<copyright>James South</copyright>
<language>en-GB</language>
<tags>Image Resize Crop Rotate Quality Watermark Gif Jpg Jpeg Bitmap Png Tiff WebP</tags>
<dependencies>
<group targetFramework=".NETFramework4.5">
<dependency id="ImageProcessor" version="2.0.0.0" />
</group>
</dependencies>
</metadata>
<files>
<file src="..\content\ImageProcessor.Plugins.WebP\web.config.transform" target="content\web.config.transform" />
<file src="..\_BuildOutput\ImageProcessor.Plugins.WebP\lib\net45\ImageProcessor.Plugins.WebP.dll" target="lib\net45\ImageProcessor.Plugins.WebP.dll" />
</files>
</package>

56
build/NuSpecs/ImageProcessor.Web.Config.nuspec

@ -1,35 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>ImageProcessor.Web.Config</id>
<version>2.1.0.0</version>
<title>ImageProcessor.Web.Config</title>
<authors>James South</authors>
<owners>James South</owners>
<projectUrl>http://imageprocessor.org</projectUrl>
<iconUrl>http://imageprocessor.org/assets/ico/apple-touch-icon-144x144.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Adds configuration to your ImageProcessor.Web solution to allow you to override the default settings.
<metadata>
<id>ImageProcessor.Web.Config</id>
<version>2.1.0.0</version>
<title>ImageProcessor.Web.Config</title>
<authors>James South</authors>
<owners>James South</owners>
<projectUrl>http://imageprocessor.org</projectUrl>
<iconUrl>http://imageprocessor.org/assets/ico/apple-touch-icon-144x144.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Adds configuration to your ImageProcessor.Web solution to allow you to override the default settings.
If you use ImageProcessor please get in touch via my twitter @james_m_south
Feedback is always welcome</description>
<summary>ImageProcessor.Web configuration settings for ASP.NET websites.</summary>
<releaseNotes />
<copyright>James South</copyright>
<language>en-GB</language>
<tags>Image Resize Crop Rotate Quality Watermark Gif Jpg Jpeg Bitmap Png Tiff ASP Cache EXIF</tags>
<dependencies>
<group targetFramework=".NETFramework4.5">
<dependency id="ImageProcessor" version="2.1.0.0" />
<dependency id="ImageProcessor.Web" version="4.1.0.0" />
</group>
</dependencies>
</metadata>
<files>
<file src="..\..\src\ImageProcessor.Web\Configuration\Resources\cache.config" target="content\config\imageprocessor\cache.config" />
<file src="..\..\src\ImageProcessor.Web\Configuration\Resources\processing.config" target="content\config\imageprocessor\processing.config" />
<file src="..\..\src\ImageProcessor.Web\Configuration\Resources\security.config" target="content\config\imageprocessor\security.config" />
<file src="..\content\ImageProcessor.Web.Config\web.config.transform" target="content\web.config.transform" />
</files>
<summary>ImageProcessor.Web configuration settings for ASP.NET websites.</summary>
<releaseNotes />
<copyright>James South</copyright>
<language>en-GB</language>
<tags>Image Resize Crop Rotate Quality Watermark Gif Jpg Jpeg Bitmap Png Tiff ASP Cache EXIF</tags>
<dependencies>
<group targetFramework=".NETFramework4.5">
<dependency id="ImageProcessor" version="2.1.0.0" />
<dependency id="ImageProcessor.Web" version="4.1.0.0" />
</group>
</dependencies>
</metadata>
<files>
<file src="..\..\src\ImageProcessor.Web\Configuration\Resources\cache.config" target="content\config\imageprocessor\cache.config" />
<file src="..\..\src\ImageProcessor.Web\Configuration\Resources\processing.config" target="content\config\imageprocessor\processing.config" />
<file src="..\..\src\ImageProcessor.Web\Configuration\Resources\security.config" target="content\config\imageprocessor\security.config" />
<file src="..\content\ImageProcessor.Web.Config\web.config.transform" target="content\web.config.transform" />
</files>
</package>

50
build/NuSpecs/ImageProcessor.Web.nuspec

@ -1,34 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>ImageProcessor.Web</id>
<version>4.1.0.0</version>
<title>ImageProcessor.Web</title>
<authors>James South</authors>
<owners>James South</owners>
<projectUrl>http://imageprocessor.org</projectUrl>
<iconUrl>http://imageprocessor.org/assets/ico/apple-touch-icon-144x144.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>ImageProcessor.Web adds a configurable HttpModule to your website which allows on-the-fly processing of image files. The module also comes with a file and browser based cache that can handle millions of images, increasing your processing output and saving precious server memory.
<metadata>
<id>ImageProcessor.Web</id>
<version>4.1.1.0</version>
<title>ImageProcessor.Web</title>
<authors>James South</authors>
<owners>James South</owners>
<projectUrl>http://imageprocessor.org</projectUrl>
<iconUrl>http://imageprocessor.org/assets/ico/apple-touch-icon-144x144.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>ImageProcessor.Web adds a configurable HttpModule to your website which allows on-the-fly processing of image files. The module also comes with a file and browser based cache that can handle millions of images, increasing your processing output and saving precious server memory.
Methods include: Resize, Rotate, Rounded Corners, Flip, Crop, Watermark, Filter, Saturation, Brightness, Contrast, Quality, Format, Vignette, Gaussian Blur, Gaussian Sharpen, and Transparency.
If you use ImageProcessor please get in touch via my twitter @james_m_south
Feedback is always welcome</description>
<summary>An extension to ImageProcessor that allows on-the-fly processing of image files in an ASP.NET website</summary>
<releaseNotes />
<copyright>James South</copyright>
<language>en-GB</language>
<tags>Image Resize Crop Rotate Quality Watermark Gif Jpg Jpeg Bitmap Png Tiff ASP Cache EXIF</tags>
<dependencies>
<group targetFramework=".NETFramework4.5">
<dependency id="ImageProcessor" version="2.1.0.0" />
</group>
</dependencies>
</metadata>
<files>
<file src="..\content\ImageProcessor.Web\web.config.transform" target="content\web.config.transform" />
<file src="..\_BuildOutput\ImageProcessor.Web\lib\net45\ImageProcessor.Web.dll" target="lib\net45\ImageProcessor.Web.dll" />
</files>
<summary>An extension to ImageProcessor that allows on-the-fly processing of image files in an ASP.NET website</summary>
<releaseNotes />
<copyright>James South</copyright>
<language>en-GB</language>
<tags>Image Resize Crop Rotate Quality Watermark Gif Jpg Jpeg Bitmap Png Tiff ASP Cache EXIF</tags>
<dependencies>
<group targetFramework=".NETFramework4.5">
<dependency id="ImageProcessor" version="2.1.0.0" />
</group>
</dependencies>
</metadata>
<files>
<file src="..\content\ImageProcessor.Web\web.config.transform" target="content\web.config.transform" />
<file src="..\_BuildOutput\ImageProcessor.Web\lib\net45\ImageProcessor.Web.dll" target="lib\net45\ImageProcessor.Web.dll" />
</files>
</package>

40
build/NuSpecs/ImageProcessor.nuspec

@ -1,29 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>ImageProcessor</id>
<version>2.1.0.0</version>
<title>ImageProcessor</title>
<authors>James South</authors>
<owners>James South</owners>
<projectUrl>http://imageprocessor.org</projectUrl>
<iconUrl>http://imageprocessor.org/assets/ico/apple-touch-icon-144x144.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Image Processor is an easy to use and extend processing library written in C#. Its fluent API makes common imaging tasks very simple to perform.
<metadata>
<id>ImageProcessor</id>
<version>2.1.0.0</version>
<title>ImageProcessor</title>
<authors>James South</authors>
<owners>James South</owners>
<projectUrl>http://imageprocessor.org</projectUrl>
<iconUrl>http://imageprocessor.org/assets/ico/apple-touch-icon-144x144.png</iconUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Image Processor is an easy to use and extend processing library written in C#. Its fluent API makes common imaging tasks very simple to perform.
Methods include; Resize, Rotate, Rounded Corners, Flip, Crop, Watermark, Filter, Saturation, Brightness, Contrast, Quality, Format, Vignette, Gaussian Blur, Gaussian Sharpen, and Transparency.
If you use ImageProcessor please get in touch on my twitter @james_m_south.
Feedback is always welcome.</description>
<summary>A library for manipulating image files written in C#.</summary>
<releaseNotes />
<copyright>James South</copyright>
<language>en-GB</language>
<tags>Image Resize Crop Rotate Quality Watermark Gif Jpg Jpeg Bitmap Png Tiff Fluent Animated EXIF</tags>
</metadata>
<files>
<file src="..\_BuildOutput\ImageProcessor\lib\net40\ImageProcessor.dll" target="lib\net40\ImageProcessor.dll" />
<file src="..\_BuildOutput\ImageProcessor\lib\net45\ImageProcessor.dll" target="lib\net45\ImageProcessor.dll" />
</files>
<summary>A library for manipulating image files written in C#.</summary>
<releaseNotes />
<copyright>James South</copyright>
<language>en-GB</language>
<tags>Image Resize Crop Rotate Quality Watermark Gif Jpg Jpeg Bitmap Png Tiff Fluent Animated EXIF</tags>
</metadata>
<files>
<file src="..\_BuildOutput\ImageProcessor\lib\net40\ImageProcessor.dll" target="lib\net40\ImageProcessor.dll" />
<file src="..\_BuildOutput\ImageProcessor\lib\net45\ImageProcessor.dll" target="lib\net45\ImageProcessor.dll" />
</files>
</package>

2
build/build.xml

@ -13,7 +13,7 @@
<project>
<name>ImageProcessor Web</name>
<version>4.1.0.0</version>
<version>4.1.1.0</version>
<folder>..\src\ImageProcessor.Web</folder>
<projfile>ImageProcessor.Web.csproj</projfile>
<outputs>

7
src/ImageProcessor.Web/Configuration/ImageProcessorConfiguration.cs

@ -348,12 +348,9 @@ namespace ImageProcessor.Web.Configuration
IImageService imageService = Activator.CreateInstance(type) as IImageService;
if (!string.IsNullOrWhiteSpace(config.Prefix))
{
if (!string.IsNullOrWhiteSpace(config.Prefix))
if (imageService != null)
{
if (imageService != null)
{
imageService.Prefix = config.Prefix;
}
imageService.Prefix = config.Prefix;
}
}

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

@ -280,11 +280,12 @@ namespace ImageProcessor.Web.HttpModules
if (currentService != null)
{
bool isFileLocal = currentService.IsFileLocalService;
bool hasMultiParams = request.Url.ToString().Count(f => f == '?') > 1;
string requestPath = string.Empty;
string queryString = string.Empty;
string urlParameters = string.Empty;
if (!isFileLocal)
if (hasMultiParams)
{
// We need to split the querystring to get the actual values we want.
string urlDecode = HttpUtility.UrlDecode(request.QueryString.ToString());
@ -376,9 +377,11 @@ namespace ImageProcessor.Web.HttpModules
{
byte[] imageBuffer;
if (!isFileLocal)
if (hasMultiParams)
{
Uri uri = new Uri(requestPath + "?" + urlParameters);
Uri uri = string.IsNullOrWhiteSpace(urlParameters)
? new Uri(requestPath, UriKind.RelativeOrAbsolute)
: new Uri(requestPath + "?" + urlParameters, UriKind.RelativeOrAbsolute);
imageBuffer = await currentService.GetImage(uri);
}
else
@ -434,12 +437,21 @@ namespace ImageProcessor.Web.HttpModules
if (isFileLocal)
{
// Set the headers and quit.
this.SetHeaders(context, (string)context.Items[CachedResponseTypeKey], new List<string> { requestPath, cachedPath });
return;
// Set the headers and quit.
// Some services might only provide filename so we can't monitor for the browser.
this.SetHeaders(
context,
(string)context.Items[CachedResponseTypeKey],
Path.GetFileName(requestPath) == requestPath ? new List<string> { cachedPath } : new List<string> { requestPath, cachedPath });
}
else
{
this.SetHeaders(context, (string)context.Items[CachedResponseTypeKey], new List<string> { cachedPath });
}
this.SetHeaders(context, (string)context.Items[CachedResponseTypeKey], new List<string> { cachedPath });
// Complete the requests but don't abort the thread.
context.ApplicationInstance.CompleteRequest();
return;
}
// The cached file is valid so just rewrite the path.
@ -450,11 +462,6 @@ namespace ImageProcessor.Web.HttpModules
throw new HttpException(403, "Access denied");
}
}
else if (!isFileLocal)
{
// Just re-point to the external url.
HttpContext.Current.Response.Redirect(requestPath);
}
}
}
@ -496,6 +503,9 @@ namespace ImageProcessor.Web.HttpModules
cache.SetExpires(DateTime.Now.ToUniversalTime().AddDays(maxDays));
cache.SetMaxAge(new TimeSpan(maxDays, 0, 0, 0));
cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
context.Items[CachedResponseTypeKey] = null;
context.Items[CachedResponseFileDependency] = null;
}
/// <summary>

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

@ -40,5 +40,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("4.1.0.0")]
[assembly: AssemblyFileVersion("4.1.0.0")]
[assembly: AssemblyVersion("4.1.1.0")]
[assembly: AssemblyFileVersion("4.1.1.0")]

130
src/TestWebsites/MVC/TestImageService.cs

@ -0,0 +1,130 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="TestImageService.cs" company="James South">
// Copyright (c) James South.
// Licensed under the Apache License, Version 2.0.
// </copyright>
// <summary>
// The test image service.
// </summary>
// --------------------------------------------------------------------------------------------------------------------
namespace Test_Website_NET45
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using System.Web;
using System.Web.Hosting;
using ImageProcessor.Web.Services;
/// <summary>
/// The test image service.
/// </summary>
public class TestImageService : IImageService
{
/// <summary>
/// The prefix for the given implementation.
/// </summary>
private string prefix = "testprovider.axd";
/// <summary>
/// Gets or sets the prefix for the given implementation.
/// <remarks>
/// This value is used as a prefix for any image requests that should use this service.
/// </remarks>
/// </summary>
public string Prefix
{
get
{
return this.prefix;
}
set
{
this.prefix = value;
}
}
/// <summary>
/// Gets a value indicating whether the image service requests files from
/// the locally based file system.
/// </summary>
public bool IsFileLocalService
{
get
{
return true;
}
}
/// <summary>
/// Gets or sets any additional settings required by the service.
/// </summary>
public Dictionary<string, string> Settings { get; set; }
/// <summary>
/// Gets or sets the white list of <see cref="System.Uri"/>.
/// </summary>
public Uri[] WhiteList { get; set; }
/// <summary>
/// Gets a value indicating whether the current request passes sanitizing rules.
/// </summary>
/// <param name="path">
/// The image path.
/// </param>
/// <returns>
/// <c>True</c> if the request is valid; otherwise, <c>False</c>.
/// </returns>
public bool IsValidRequest(string path)
{
return true;
}
/// <summary>
/// Gets the image using the given identifier.
/// </summary>
/// <param name="id">
/// The value identifying the image to fetch.
/// </param>
/// <returns>
/// The <see cref="System.Byte"/> array containing the image data.
/// </returns>
public async Task<byte[]> GetImage(object id)
{
const string AppData = "~/App_Data/images";
string imageRoot = HostingEnvironment.MapPath(AppData);
if (imageRoot == null)
{
throw new HttpException(404, "No root path found to serve " + id);
}
// In this instance we are just processing a set path.
// If you are using the querystring params as a means of identifying the correct image
// then you can do something with it here.
string path = Path.Combine(imageRoot, id.ToString().Split(new[] { '&', '?' })[0]);
byte[] buffer;
// Check to see if the file exists.
// ReSharper disable once AssignNullToNotNullAttribute
FileInfo fileInfo = new FileInfo(path);
if (!fileInfo.Exists)
{
throw new HttpException(404, "Nothing found at " + id);
}
using (FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 4096, true))
{
buffer = new byte[file.Length];
await file.ReadAsync(buffer, 0, (int)file.Length);
}
return buffer;
}
}
}

1
src/TestWebsites/MVC/Test_Website_MVC.csproj

@ -109,6 +109,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="TestImageService.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>

Loading…
Cancel
Save