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.

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

result:
<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:
@ResizedImageUrl(image.FilePath, width:250, height:190)

returns:
/Media/Amba.ImageCache/Default/img/lolcats/fatcat-6DEBDBE03B0671AC98D6E771A48503E5.jpg



Last edited Oct 8, 2012 at 8:47 PM by musukvl, version 4

Comments

No comments yet.