mirror of https://github.com/SixLabors/ImageSharp
11 changed files with 172 additions and 15 deletions
@ -0,0 +1 @@ |
|||
<cache virtualPath="~/app_data/cache" maxDays="356"/> |
|||
@ -0,0 +1,39 @@ |
|||
<processing> |
|||
<presets> |
|||
</presets> |
|||
<plugins autoLoadPlugins="true"> |
|||
<plugin name="Alpha" type="ImageProcessor.Processors.Alpha, ImageProcessor"/> |
|||
<plugin name="Brightness" type="ImageProcessor.Processors.Brightness, ImageProcessor"/> |
|||
<plugin name="Contrast" type="ImageProcessor.Processors.Contrast, ImageProcessor"/> |
|||
<plugin name="Crop" type="ImageProcessor.Processors.Crop, ImageProcessor"/> |
|||
<plugin name="Filter" type="ImageProcessor.Processors.Filter, ImageProcessor"/> |
|||
<plugin name="Flip" type="ImageProcessor.Processors.Flip, ImageProcessor"/> |
|||
<plugin name="Format" type="ImageProcessor.Processors.Format, ImageProcessor"/> |
|||
<plugin name="GaussianBlur" type="ImageProcessor.Processors.GaussianBlur, ImageProcessor"> |
|||
<settings> |
|||
<setting key="MaxSize" value="22"/> |
|||
<setting key="MaxSigma" value="5.1"/> |
|||
<setting key="MaxThreshold" value="100"/> |
|||
</settings> |
|||
</plugin> |
|||
<plugin name="GaussianSharpen" type="ImageProcessor.Processors.GaussianSharpen, ImageProcessor"> |
|||
<settings> |
|||
<setting key="MaxSize" value="22"/> |
|||
<setting key="MaxSigma" value="5.1"/> |
|||
<setting key="MaxThreshold" value="100"/> |
|||
</settings> |
|||
</plugin> |
|||
<plugin name="Quality" type="ImageProcessor.Processors.Quality, ImageProcessor"/> |
|||
<plugin name="Resize" type="ImageProcessor.Processors.Resize, ImageProcessor"> |
|||
<settings> |
|||
<setting key="MaxWidth" value="5000"/> |
|||
<setting key="MaxHeight" value="5000"/> |
|||
</settings> |
|||
</plugin> |
|||
<plugin name="Rotate" type="ImageProcessor.Processors.Rotate, ImageProcessor"/> |
|||
<plugin name="RoundedCorners" type="ImageProcessor.Processors.RoundedCorners, ImageProcessor"/> |
|||
<plugin name="Saturation" type="ImageProcessor.Processors.Saturation, ImageProcessor"/> |
|||
<plugin name="Vignette" type="ImageProcessor.Processors.Vignette, ImageProcessor"/> |
|||
<plugin name="Watermark" type="ImageProcessor.Processors.Watermark, ImageProcessor"/> |
|||
</plugins> |
|||
</processing> |
|||
@ -0,0 +1,4 @@ |
|||
<security allowRemoteDownloads="true" timeout="300000" maxBytes="4194304" remotePrefix="/remote.axd"> |
|||
<whiteList> |
|||
</whiteList> |
|||
</security> |
|||
@ -0,0 +1,56 @@ |
|||
// --------------------------------------------------------------------------------------------------------------------
|
|||
// <copyright file="ResourceHelpers.cs" company="James South">
|
|||
// Copyright (c) James South.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
// </copyright>
|
|||
// <summary>
|
|||
// Provides helper methods for working with resources.
|
|||
// </summary>
|
|||
// --------------------------------------------------------------------------------------------------------------------
|
|||
|
|||
namespace ImageProcessor.Web.Helpers |
|||
{ |
|||
using System.IO; |
|||
using System.Reflection; |
|||
using System.Text; |
|||
|
|||
/// <summary>
|
|||
/// Provides helper methods for working with resources.
|
|||
/// </summary>
|
|||
public class ResourceHelpers |
|||
{ |
|||
/// <summary>
|
|||
/// Converts an assembly resource into a string.
|
|||
/// </summary>
|
|||
/// <param name="resource">
|
|||
/// The resource.
|
|||
/// </param>
|
|||
/// <param name="assembly">
|
|||
/// The assembly.
|
|||
/// </param>
|
|||
/// <param name="encoding">
|
|||
/// The character encoding to return the resource in.
|
|||
/// </param>
|
|||
/// <returns>
|
|||
/// The <see cref="string"/>.
|
|||
/// </returns>
|
|||
public static string ResourceAsString(string resource, Assembly assembly = null, Encoding encoding = null) |
|||
{ |
|||
assembly = assembly ?? Assembly.GetExecutingAssembly(); |
|||
encoding = encoding ?? Encoding.UTF8; |
|||
|
|||
using (MemoryStream ms = new MemoryStream()) |
|||
{ |
|||
using (Stream manifestResourceStream = assembly.GetManifestResourceStream(resource)) |
|||
{ |
|||
if (manifestResourceStream != null) |
|||
{ |
|||
manifestResourceStream.CopyTo(ms); |
|||
} |
|||
} |
|||
|
|||
return encoding.GetString(ms.GetBuffer()).Replace('\0', ' ').Trim(); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
Binary file not shown.
Loading…
Reference in new issue