[RESOLVED]Can System.Web.Helpers.WebImage be used to dynamicly resize images for display on webpages?

I have been looking at a way to store a single large file on the server but dynamically resize it depending on what the user wants (think wallpapers for download) when I ran across the System.Web.Helpers.WebImage class. I have been doing some searching but
everything I find looks to be for resizing and then saving the new image to the server. I was wondering if/how this class could be used in an ASP.Net MVC Web App to dynamically resize an image and serve it up to the web page with out saving the resized image
to the server.

You can do this with the gdi components

http://weblog.west-wind.com/posts/2004/Feb/26/Creating-Thumbnail-Images-on-the-fly-with-ASPNet

the above is for webforms, but the code will be the same except you return a File result from your controller

http://msdn.microsoft.com/en-us/library/dd492897%28v=vs.98%29.aspx

If you google for creating thumbnails on the fly you’ll probably find an mvc-specific example.

Hi,

According to the doc, it seems like .Write() just sent the image content to the browser output. At worst you could use GetBytes() to get the bytes and write them yourself.

Searching based on that gave me things like:

http://www.leniel.net/2012/04/resize-img-on-fly-aspnet-webimage.html#sthash.aoiVMWxR.dpbs or

http://forums.asp.net/t/1699090.aspx?Displaying+image+from+database+using+webimage+helper

Here is a MVC version of thumbnail

ASP.NET MVC ImageHandler for Thumbnails

Leave a Reply