We are currently upgrading a site to cms 12 and are experiencing issues when generating thumbnails in the cms. Thumbnails are generated as a 1x1 pixel image. The class we are using for images is inheriting from the ImageData class and using the standard Thumbnail property
We have tried overirding this and setting Pregenerated to false. This gives us the following 500 error when trying to retrieve a thumbnail.
Has anyone experienced these issues before?
A shot in the dark but it sounds like Imagesharp is interfering with Thumbnail generation. Can you disable it and retry?
You're in the right ballpark. Looks to be a breaking change in Imagesharp 3. From Optimizely
'I think you may have to downgrade SixLabors.ImageSharp to version 2.0 as there's a breaking change in its version 3.x that breaks the CMS internal resizing function. The reason is, two encoder classes SixLabors.ImageSharp.Formats.Jpeg.JpegEncoder and SixLabors.ImageSharp.Formats.Png.PngEncoder has changed in SixLabors.ImageSharp 3.x. For example: JpegEncoder.Quality field is no longer having its set method when our CMS internal code of IImageService is using that set method, which exists in ImageSharp 2.0.'
Downgraded to the last release of v2.x and it seems to have worked.
Since one of our other dependencies required ImageSharp 3.x, I ended up copying the code from DefaultImageService.cs (Episerver.ImageLibrary.dll) into my project and used that instead. It just required a recompile, no code changes, against ImageSharp 3.
public void ConfigureServices(IServiceCollection services)
Here was the response from Optimizely Support:
"Right now, we have yet had any plan to upgrade that in the near future due to numerous of breaking changes of ImageSharp v3. Forcing the installation of ImageSharp 3 breaks some functionalities of assets management in CMS edit mode."
Edit: ImageSharp dependency will be removed in an upcoming version of Episerver.Cms, hopefully next week.
Verifying a site on Integration where I'm now running 12.17.0 of EPiServer.Hosting with these:
<PackageReference Include="EPiServer.ImageLibrary.ImageSharp" Version="2.0.1" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.0.1" />
Site has some custom ImageSharp code as well and all seems to be working fine...