Files
EmbedImageMiddleware/Readme.md
Tommy Parnell 6dd32b43ec props
2016-07-23 21:07:54 -04:00

718 B

This is a simple aspnet middlewear inspired by a rack middlewear, that converts your small images to base64 encoded data tags in html.

I wouldn't actually recommend doing this, I mostly did this to see what is possible in aspnet core middlwear. There is much evidence to suggest that it is a bad idea

How to use:

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
        {

            app.UseEmbedImages(env);

        }

Before

<img src="/path/to/img.jpg" />

After

<img src="data:img/jpeg;base64,=randomdatahere" />