mirror of https://github.com/SixLabors/ImageSharp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.4 KiB
36 lines
1.4 KiB
// --------------------------------------------------------------------------------------------------------------------
|
|
// <copyright file="ImageProcessingModule.cs" company="James South">
|
|
// Copyright (c) James South.
|
|
// Licensed under the Apache License, Version 2.0.
|
|
// </copyright>
|
|
// <summary>
|
|
// PostProcesses any image requests within the web application.
|
|
// Many thanks to Azure Image Optimizer <see href="https://github.com/ligershark/AzureJobs"/>
|
|
// </summary>
|
|
// --------------------------------------------------------------------------------------------------------------------
|
|
|
|
using System.Web;
|
|
|
|
[assembly: PreApplicationStartMethod(typeof(ImageProcessor.Web.PostProcessor.ApplicationEvents), "Start")]
|
|
namespace ImageProcessor.Web.PostProcessor
|
|
{
|
|
using ImageProcessor.Web.Helpers;
|
|
using ImageProcessor.Web.HttpModules;
|
|
|
|
/// <summary>
|
|
/// PostProcesses any image requests within the web application.
|
|
/// Many thanks to Azure Image Optimizer <see href="https://github.com/ligershark/AzureJobs"/>
|
|
/// </summary>
|
|
public static class ApplicationEvents
|
|
{
|
|
public static void Start()
|
|
{
|
|
ImageProcessingModule.OnPostProcessing += PostProcess;
|
|
}
|
|
|
|
private static async void PostProcess(object sender, PostProcessingEventArgs e)
|
|
{
|
|
await PostProcessor.PostProcessImage(e.CachedImagePath);
|
|
}
|
|
}
|
|
}
|
|
|