mirror of https://github.com/SixLabors/ImageSharp
Browse Source
Former-commit-id: 2f6b172392cb9955180ac153d260eb4cb4441442 Former-commit-id: 70f6be3cd0a97a828907f2d26f5e49d989e2b773pull/17/head
11 changed files with 280 additions and 142 deletions
@ -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> |
|||
@ -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> |
|||
@ -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> |
|||
@ -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> |
|||
@ -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> |
|||
@ -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; |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue