Closed AndreaPiovanelli closed 7 months ago
How is the wrapper you point to solving the issue?
How is the wrapper you point to solving the issue?
It checks for the presence of ImagePart (line 118) and, if found, resizes the media with current operations. If there is not ImagePart, the media doesn't get resized and original unprocessed media url is displayed (lines 121 and 122).
As a note: That check for ImagePart, if moved to MediaProcessing, would likely be in the ImageProfileManager, rather than in the shape. Anyway, even if it were in the ResizeMediaUrl shape, it would still provide cleaner fix than having to check for it in every shape where that is used (or, as we did, using a wrapper around ResizeMediaUrl)
https://github.com/OrchardCMS/Orchard/blob/9644ceda1f9b077d44aaa4ffaab103c19a59ddba/src/Orchard.Web/Modules/Orchard.MediaProcessing/Shapes/MediaShapes.cs#L56C31-L56C31
Display.ResizeMediaUrl calls throw exceptions everytime the function is called for a media which isn't a proper image (it fails for vector images, for instance). The exception is the following:
We already implemented a wrapper solving the issue, which you can find here: https://github.com/LaserSrl/Laser.Orchard.Platform/blob/aaab8efef30ffd5ee4277cfb84741411bd812449/src/Modules/Laser.Orchard.StartupConfig/Services/ThemeHelperService.cs#L116
Shall we move that code directly to Orchard.MediaProcessing module? Any suggestion for other possible solutions to this issue?