OrchardCMS / OrchardCore

Orchard Core is an open-source modular and multi-tenant application framework built with ASP.NET Core, and a content management system (CMS) built on top of that framework.
https://orchardcore.net
BSD 3-Clause "New" or "Revised" License
7.42k stars 2.39k forks source link

How to remove middleware, such as ImageSharp, in OWIN #1477

Closed infofromca closed 5 years ago

infofromca commented 6 years ago

In my own module, I want to implement my own services.AddImageSharpCore for ImageSharp. 1---in this way, I need to remove it from OrchardCore.Media module, I think. 2---how?, can orchard do that? it seems that asp.net core can not do that directly. thanks andy

sebastienros commented 6 years ago

Two solutions:

We could also do both.

However you can already configure it from your module, you can call AddImageSharpCore a second time and override anything you want. We tried it already to customize the compression levels.

c.f. https://github.com/OrchardCMS/OrchardCore/blob/dev/src/OrchardCore.Modules/OrchardCore.Media/Startup.cs#L85

infofromca commented 6 years ago

overriding is not the best choice. my situation is that in my special situation(module), i do not want to apply public static int[] Sizes = new[] { 16, 32, 50, 100, 160, 240, 480, 600, 1024, 2048 }; because editing image is inside admin panel. but I also want to keep applying public static int[] Sizes = new[] { 16, 32, 50, 100, 160, 240, 480, 600, 1024, 2048 }; when in normal resize -- external url.

sebastienros commented 6 years ago

because editing image is inside admin panel.

I don't understand this statement. Can you rephrase what you are doing?

infofromca commented 6 years ago

i do not want to apply public static int[] Sizes = new[] { 16, 32, 50, 100, 160, 240, 480, 600, 1024, 2048 }; because editing image is inside admin panel.

means

i do not want to apply public static int[] Sizes = new[] { 16, 32, 50, 100, 160, 240, 480, 600, 1024, 2048 }; in the dashboard for editing image .

================== there are 2 situation. 1- use my custom feature in one case 2--keep use the original feature of OrchardCore.Media module in another case

sebastienros commented 5 years ago

You can customize these settings now.