Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Kamil 6 posts 75 karma points
    Jun 17, 2022 @ 06:32


    yesterday I began the process of migrating my Umbraco 8 build over to Umbraco 10. So far it's been pretty flawless (got the build up and running within few hours) - altough I'm struggling to get the WebP optimization to work properly.

    I've registered the ImageSharp2 in the startup as follows:

        public void ConfigureServices(IServiceCollection services)
            services.AddUmbraco(_env, _config)


    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
            .WithMiddleware(u =>
            .WithEndpoints(u =>

    The result I get is that static files are optimized properly, but media library items aren't. I tried putting these methods in different orders but the result is the same.

    Maybe anyone knows / sees what is the problem here?

    Best, Kamil

  • Søren Kottal 641 posts 4110 karma points MVP 4x c-trib
    Jun 17, 2022 @ 06:47
    Søren Kottal

    Umbraco should register ImageSharp for you, try removing your own registration and see if that works.

  • Kamil 6 posts 75 karma points
    Jun 17, 2022 @ 07:36

    Thanks for your answer - it doesn't have any effect. I think I found the cause - altough not a fix yet.

    My case is that my Media files from Umbraco 8 are stored in folder ~/Media (from the root of the solution).

    Newly uploaded files land in ~/wwwroot/media with correct path stored in the DB.

    First issue here is that they aren't served properly returning 404.

    Second issue here is that the ImageSharp by default expects the source to be coming from wwwroot, therefore it does not work for my existing images. Ref:

  • Kamil 6 posts 75 karma points
    Jun 17, 2022 @ 07:56

    OK - I've found the solution. Because I've left the Media folder untouched, the same issue happened for me as described here:

    I've copied the elements over in the wwwroot/media and removed the original Media folder and both issues are solved.

    About my original question: The ImageSharp does not work without explicitly registering it but that's not a problem.

    Now, as the media files are served from wwwroot, it works.

Please Sign in or register to post replies

Write your reply to: