Nothing much to describe here :) Just install NuGet package and it will register EPiServer Blob reader plugin for ImageResizer in order to serve and process images from EPiServer Media folders by ImageResizer.
If you use fluent API to resize the image and pass in null, string.Empty or ContentReference.EmptyReference you will get ArgumentNullException exception.
Most convenient way to render image in markup would be use HtmlHelper extension method:
@using ImageResizer.Plugins.EPiServer
<img src="@Html.ResizeImage(Model.CurrentPage.MainImage, 100, 100)" />
This will make sure that markup for visitors would be (assuming that image is png):
<image src="/.../image.png?w=100&h=100">
And also for the edit mode it would be generated something like this:
<image src="/.../image.png,,{CONTENT-ID}?epieditmode=False&w=100&h=100">
ResizeImage returns back UrlBuilder type, so you can fluently chain any additional paramters if needed:
<img src="@Html.ResizeImage(Model.CurrentPage.MainImage, 100, 150).Add("gradient", "true").Add("bgcolor", "red)" />
You can also use some basic fluent api support as well:
<img src="@Html.ResizeImage(CurrentPage.MainImage).Width(200)
.Height(200)
.Scale(ScaleMode.Both)
.FitMode(FitMode.Crop)" />
If you need to fallback to other image in cases when given ContentReference is empty (and don't want to check for null or ContentReference.EmptyReference yourself) you can use resize image with fallback:
<img src="@Html.ResizeImageWithFallback(CurrentPage.MainImage, "/no-image.jpg").Width(200).Height(200).Scale(ScaleMode.Both).FitMode(FitMode.Crop)" />
Happy imaging!