Skip to content
This repository has been archived by the owner on Sep 6, 2023. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
JimBobSquarePants committed Sep 12, 2017
2 parents 9d27472 + 29ab88c commit b3ae111
Show file tree
Hide file tree
Showing 21 changed files with 141 additions and 115 deletions.
2 changes: 1 addition & 1 deletion build/NuSpecs/ImageProcessor.Web.PostProcessor.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Feedback is always welcome</description>
<dependencies>
<group targetFramework=".NETFramework4.5">
<dependency id="ImageProcessor" version="2.5.4.0" />
<dependency id="ImageProcessor.Web" version="4.8.4.0" />
<dependency id="ImageProcessor.Web" version="4.8.5.0" />
</group>
</dependencies>
</metadata>
Expand Down
5 changes: 3 additions & 2 deletions build/NuSpecs/ImageProcessor.Web.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@ Feedback is always welcome</description>
<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.5.4.0" />
<dependency id="ImageProcessor" version="2.5.5.0" />
<dependency id="Microsoft.IO.RecyclableMemoryStream" version="1.2.2" />
</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" />
<file src="..\_BuildOutput\ImageProcessor.Web\lib\net45\ImageProcessor.Web.dll" target="lib\net45" />
<file src="..\_BuildOutput\ImageProcessor.Web\lib\net45\ImageProcessor.Web.xml" target="lib\net45" />
</files>
</package>
50 changes: 27 additions & 23 deletions build/NuSpecs/ImageProcessor.nuspec
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
<metadata>
<id>ImageProcessor</id>
<version>$version$</version>
<title>ImageProcessor</title>
<authors>James Jackson-South</authors>
<owners>James Jackson-South</owners>
<projectUrl>http://imageprocessor.org</projectUrl>
<iconUrl>https://raw.githubusercontent.com/JimBobSquarePants/ImageProcessor/develop/build/icons/imageprocessor-logo-128.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>$version$</version>
<title>ImageProcessor</title>
<authors>James Jackson-South</authors>
<owners>James Jackson-South</owners>
<projectUrl>http://imageprocessor.org</projectUrl>
<iconUrl>https://raw.githubusercontent.com/JimBobSquarePants/ImageProcessor/develop/build/icons/imageprocessor-logo-128.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.
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.
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 Jackson-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>
Feedback is always welcome.
</description>
<summary>A library for manipulating image files written in C#.</summary>
<releaseNotes />
<copyright>James Jackson-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" />
<file src="..\_BuildOutput\ImageProcessor\lib\net40\ImageProcessor.xml" target="lib\net40" />
<file src="..\_BuildOutput\ImageProcessor\lib\net45\ImageProcessor.dll" target="lib\net45" />
<file src="..\_BuildOutput\ImageProcessor\lib\net45\ImageProcessor.xml" target="lib\net45" />
</files>
</package>
6 changes: 3 additions & 3 deletions build/build.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<projects>
<project>
<name>ImageProcessor</name>
<version>2.5.4.0</version>
<version>2.5.5.0</version>
<!--<prerelease>-beta</prerelease>-->
<folder>..\src\ImageProcessor</folder>
<projfile>ImageProcessor.csproj</projfile>
Expand All @@ -15,7 +15,7 @@
<project>
<name>ImageProcessor Web</name>
<!--<prerelease>-beta</prerelease>-->
<version>4.8.4.0</version>
<version>4.8.6.0</version>
<folder>..\src\ImageProcessor.Web</folder>
<projfile>ImageProcessor.Web.csproj</projfile>
<outputs>
Expand Down Expand Up @@ -65,7 +65,7 @@

<project>
<name>ImageProcessor Web PostProcessor Plugin</name>
<version>1.2.2.0</version>
<version>1.2.3.0</version>
<folder>..\src\ImageProcessor.Web.Plugins.PostProcessor</folder>
<projfile>ImageProcessor.Web.Plugins.PostProcessor.csproj</projfile>
<outputs>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ public void RegisterExecutables()
{ "jpegtran.exe", "ImageProcessor.Web.Plugins.PostProcessor.Resources.Unmanaged.x86.jpegtran.exe" },
{ "cjpeg.exe", "ImageProcessor.Web.Plugins.PostProcessor.Resources.Unmanaged.x86.cjpeg.exe" },
{ "libjpeg-62.dll", "ImageProcessor.Web.Plugins.PostProcessor.Resources.Unmanaged.x86.libjpeg-62.dll" },
{ "optipng.exe", "ImageProcessor.Web.Plugins.PostProcessor.Resources.Unmanaged.x86.pngquant.exe" },
{ "pngquant.exe", "ImageProcessor.Web.Plugins.PostProcessor.Resources.Unmanaged.x86.pngquant.exe" },
{ "pngout.exe", "ImageProcessor.Web.Plugins.PostProcessor.Resources.Unmanaged.x86.pngout.exe" },
{ "TruePNG.exe", "ImageProcessor.Web.Plugins.PostProcessor.Resources.Unmanaged.x86.TruePNG.exe" },
{ "png.cmd", "ImageProcessor.Web.Plugins.PostProcessor.Resources.Unmanaged.x86.png.cmd" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.2.2.0")]
[assembly: AssemblyFileVersion("1.2.2.0")]
[assembly: AssemblyVersion("1.2.3.0")]
[assembly: AssemblyFileVersion("1.2.3.0")]
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pngquant --quality=90-99 --output %2 --force %1
pngquant --quality=90-99 --output %2 %1 --force
if not exist %2 copy %1 %2 /y

truepng /o4 /out %2 %1
truepng %2 /o4
31 changes: 15 additions & 16 deletions src/ImageProcessor.Web/Caching/DiskCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public override void RewritePath(HttpContext context)
// https://referencesource.microsoft.com/#System.Web/StaticFileHandler.cs,505

// 4. Use reflection to invoke the StaticFileHandler somehow
// 5. Use a custom StataicFileHandler like https://code.google.com/archive/p/talifun-web/wikis/StaticFileHandler.wiki
// 5. Use a custom StaticFileHandler like https://code.google.com/archive/p/talifun-web/wikis/StaticFileHandler.wiki

// I've opted to go with the simplest solution and use TransmitFile, I've looked into the source of this and it uses the
// Windows Kernel, I'm not sure where in the source the headers get written but if you analyze the request/response headers when
Expand All @@ -320,10 +320,10 @@ public override void RewritePath(HttpContext context)
// Since we are going to call Response.End(), we need to go ahead and set the headers
HttpModules.ImageProcessingModule.SetHeaders(context, this.BrowserMaxDays);
this.SetETagHeader(context);
context.Response.AddHeader("Content-Length", new FileInfo(this.CachedPath).Length.ToString());

context.Response.TransmitFile(this.CachedPath);
var length = new FileInfo(this.CachedPath).Length;
context.Response.AddHeader("Content-Length", length.ToString());

context.Response.TransmitFile(this.CachedPath, 0, length);

// This is quite important expecially if the request is a when an `IImageService` handles the request
// based on a custom request handler such as "database.axd/logo.png". If we don't end the request here
Expand All @@ -333,7 +333,14 @@ public override void RewritePath(HttpContext context)
// `ApplicationInstance.CompleteRequest();` instead of Response.End() but in this case I believe it is
// correct to use Response.End(), a good write-up of why this is can be found here:
// see: http://stackoverflow.com/a/36968241/694494
context.Response.End();
try
{
context.Response.End();
}
catch (ThreadAbortException)
{
Thread.ResetAbort();
}
}
}
}
Expand Down Expand Up @@ -391,21 +398,13 @@ internal static string GetValidatedCachePathsImpl(string originalPath, Func<stri

if (!dirInfo.Exists)
{
if (isInWebRoot)
{
// If this is in the web root, we should just create it
Directory.CreateDirectory(dirInfo.FullName);
}
else
{
throw new ConfigurationErrorsException("The cache folder " + absPath + " does not exist");
}
Directory.CreateDirectory(dirInfo.FullName);
}

// This does a reverse map path:
virtualCachePath = isInWebRoot
? dirInfo.FullName.Replace(webRoot, "~/").Replace(@"\", "/")
: null;
? dirInfo.FullName.Replace(webRoot, "~/").Replace(@"\", "/")
: null;

return dirInfo.FullName;
}
Expand Down
10 changes: 5 additions & 5 deletions src/ImageProcessor.Web/Caching/ImageCacheBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ protected virtual void AugmentSettings(Dictionary<string, string> settings)
{
}

/// <summary>
/// Debounces the trimming function
/// </summary>
/// <param name="trimmer">The trimming function</param>
/// <returns>The <see cref="Task"/></returns>
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("Use ScheduleCacheTrimmer instead")]
protected virtual Task DebounceTrimmerAsync(Func<Task> trimmer)
Expand Down Expand Up @@ -221,11 +226,6 @@ private class CacheTrimmer : IRegisteredObject
/// </summary>
private static bool trim;

/// <summary>
/// The asynchronous trimmer task
/// </summary>
// private static Task task;

/// <summary>
/// The cancellation token source
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// </summary>
// --------------------------------------------------------------------------------------------------------------------

using ImageProcessor.Web.Caching;

namespace ImageProcessor.Web.Configuration
{
using System;
Expand Down
2 changes: 1 addition & 1 deletion src/ImageProcessor.Web/Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public static bool IsValidVirtualPathName(this string expression)
public static string TrimStart(this string target, string trimString)
{
string result = target;
while (result.StartsWith(trimString))
while (result.StartsWith(trimString, StringComparison.InvariantCultureIgnoreCase))
{
result = result.Substring(trimString.Length);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private QueryParamParser()
/// The <see cref="Type"/> to convert the string to.
/// </typeparam>
/// <returns>
/// The <see cref="T"/>.
/// The <typeparamref name="T"/>.
/// </returns>
public T ParseValue<T>(string value, CultureInfo culture = null)
{
Expand Down
2 changes: 2 additions & 0 deletions src/ImageProcessor.Web/Helpers/RemoteFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
// </summary>
// --------------------------------------------------------------------------------------------------------------------

using System.Collections.Generic;

namespace ImageProcessor.Web.Helpers
{
using System;
Expand Down
Loading

0 comments on commit b3ae111

Please sign in to comment.