EPiServer Blob provider for ImageResizer.Net
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.idea
.nuget
.vs
samples/SampleAlloy
src/ImageResizer.Plugins.EPiServerBlobReader
.gitattributes
.gitignore
ImageResizer.Plugins.EPiServerBlobReader.sln
LICENSE
README.md
appveyor.yml
build-packages.ps1
nuget.config

README.md

Build status

ImageResizer.Plugins.EPiServerBlobReader

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.

Breaking Changes (starting from v6.0)

If you use fluent API to resize the image and pass in null, string.Empty or ContentReference.EmptyReference you will get ArgumentNullException exception.

Render Image in Markup

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):

<img src="/.../image.png?w=100&h=100">

And also for the edit mode it would be generated something like this:

<img 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)" />

Render Image Markup (Fluent)

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)" />

Render Image Markup with Fallback (Fluent)

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!