I'm trying to find a way to allow my umbraco9 website to serve "local" (CMS media) images via the baked in imagesharp, which is working out of the box. I've setup Azure blob storage, all working fine.
On top of that, I am in need of serving remote images. These images sit on their respective URLs (eg. images.remote1.com, images-ai.remote2.com) and since they are external, I want to crop/resize so that I can "fit" them into the design of my website.
I've found the following discussion on ImageSharp https://github.com/SixLabors/ImageSharp.Web/discussions/167, which led me to implementing the custom "remote image" provider/resolver. This works fine for the remote images, but breaks existing built in umbraco9 resizing/cropping.
So with the "remote" solution enabled, my image src="/remote/images.remote1.com?width=300" will be resized as expected, but src="/media/..." will not.
I can't seem to find a way make them work "together" (ImageSharp doesn't seem to even document configuration of multiple providers either).
.ClearProviders()
//This is my custom remote provider
.AddProvider<RemoteImageProvider>()
//Provider added by Umbraco
.AddProvider<WebRootImageProvider>()
//Processors added by Umbraco
.AddProcessor<CropWebProcessor>()
This is only tested in Umbraco 10, but I guess it will work in Umbraco 9 as well.
umbraco9 local and remote images - imagesharp
I'm trying to find a way to allow my umbraco9 website to serve "local" (CMS media) images via the baked in imagesharp, which is working out of the box. I've setup Azure blob storage, all working fine.
On top of that, I am in need of serving remote images. These images sit on their respective URLs (eg. images.remote1.com, images-ai.remote2.com) and since they are external, I want to crop/resize so that I can "fit" them into the design of my website.
I've found the following discussion on ImageSharp https://github.com/SixLabors/ImageSharp.Web/discussions/167, which led me to implementing the custom "remote image" provider/resolver. This works fine for the remote images, but breaks existing built in umbraco9 resizing/cropping.
So with the "remote" solution enabled, my image src="/remote/images.remote1.com?width=300" will be resized as expected, but src="/media/..." will not.
I can't seem to find a way make them work "together" (ImageSharp doesn't seem to even document configuration of multiple providers either).
Thoughts anyone?
Adding the startup ConfigureServices for reference:
And app settings section sample:
Hi, I know this is an old question, but I ran into this my self, and my solution was to add back the provider and processor that Umbraco adds here: https://github.com/umbraco/Umbraco-CMS/blob/b69afe81f3f6fcd37480b3b0295a62af44ede245/src/Umbraco.Cms.Imaging.ImageSharp/UmbracoBuilderExtensions.cs
This is only tested in Umbraco 10, but I guess it will work in Umbraco 9 as well.
Hi Ole.
Can you remember how you made your
RemoteImageProvider
?I guess it should inherite the interface
IImageWebProcessor
, but what did you do with theIEnumerable<string> Commands
and request?Hi, Bo! I used this gist as a base for my RemoteImageProvider: https://gist.github.com/marklagendijk/e5fd1934391a515f8c974c87024ed39c
I think this only handles the fetching of the remote image, the rest is taken care of by ImageSharp.
Please note that this is for ImageSharp, not ImageProcessor.
is working on a reply...