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:
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?
Umbraco 10 and WebP
Hi,
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:
and
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
Umbraco should register ImageSharp for you, try removing your own registration and see if that works.
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: https://github.com/SixLabors/ImageSharp.Web/issues/135
OK - I've found the solution. Because I've left the Media folder untouched, the same issue happened for me as described here: https://our.umbraco.com/forum/using-umbraco-and-getting-started/107870-umbraco-9-upload-problem-media-uploads-to-wwwrootmedia-but-gets-loaded-from-media
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.
FYI - This is a good explanation of enabling full webP support for Umbraco 10: https://us.umbhost.net/blog/2022/06/dynamic-webp-images-in-umbraco-v10
You can use this package https://marketplace.umbraco.com/package/dyfort.umbraco.autoimageoptimize it will do it automatically
Hi Yakov, does your package works with umbraco 11?
Yes, it works for Umbraco 11 as well.
Hi Yakov, i've installed the package on my local site but not seeing any conversion. Do I need to set anything else up?
Did you clear the umbraco\Data\TEMP\MediaCache folder?
is working on a reply...