Copied to clipboard

Flag this post as spam?

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


  • Bo Jacobsen 602 posts 2400 karma points
    Jul 08, 2024 @ 10:32
    Bo Jacobsen
    0

    .jfif images is not processed by ImageSharp or ImageCropper

    Using Umbraco 13

    On our test server .jfif images is not processed by ImageSharp and the Content-Type header from the response is image/pjpeg and on our local machine it works as expected and we cannot figure out why.

    Our test server runs on Windows Server 2019 with IIS 10.0.17763.1.

    We have set the MIME Types in the IIS for .jfif to image/jpeg enter image description here

    We also tried to set mimeMap in the web.config under system.webServer => staticContent. enter image description here

    And last we also tried to register the jfif mimetype in the StaticFileOptions.

    public static IUmbracoBuilder RegisterMimeTypes(this IUmbracoBuilder builder)
    {
        var mimeTypes = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
        {
            { ".jfif", "image/jpeg" }
        };
    
        var contentTypeProvider = new FileExtensionContentTypeProvider();
    
        foreach (var mimeType in mimeTypes)
        {
            if (contentTypeProvider.Mappings.ContainsKey(mimeType.Key))
            {
                contentTypeProvider.Mappings.Remove(mimeType.Key);
            }
    
            contentTypeProvider.Mappings.Add(mimeType.Key, mimeType.Value);
        }
    
        builder.Services.Configure<StaticFileOptions>(options => options.ContentTypeProvider = contentTypeProvider);
    
        return builder;
    }
    

    But nothing seems to work on our test server.

    Do anyone have any idear?

Please Sign in or register to post replies

Write your reply to:

Draft