Image resizer HTML Helper

You can use ResizedImage helper to include resized image into your views.
This helper allows to avoid requests to file handler and any redirects: it just puts link to file in file folder.
Helpers located in Amba.ImagePowerTools.HtmlHelpers namespace.

Helper call:
@Html.ResizedImage(image.FilePath, width:250, height:190, htmlAttributes: new {alt = "Lolcats"}) 

<img alt="Lolcats" style="width:250px;height:190px;" src="/Media/Amba.ImageCache/Default/img/lolcats/fatcat-6DEBDBE03B0671AC98D6E771A48503E5.jpg">

Also you can use helper to get resized image url:
@Url.ResizedImageUrl(image.FilePath, width:250, height:190)


Helpers allows to use ImageResizing commands (chcek reference: by settings parameter.
@Html.ResizedImage(image.FilePath, width:250, height:190, settings: "mode=crop&tograyscale=1" htmlAttributes: new {alt = "Lolcats"}) 

tograyscale - is custom grayscale filter included to Image Power Tools module.

Last edited Apr 12, 2013 at 10:56 AM by musukvl, version 8


No comments yet.