|
|||||||
New to SitePoint Forums? Register here for free!
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: Cape Town, South Africa
Posts: 1,587
|
Dynamic Images with MVC
Hey guys
I have finally started dabbling in MVC. Not to bad so far. Its pretty cool actually, even tho it "seems" to be a bit of a step backwards as its got not databinding, etc. lol. But anywayz, to my issue at hand. My site in asp.net usually have a thumbnailer.ashx file that does all the dynamic resizing for my needs. It is used like this: src='thumbnail.ashx?section=1&w=640&h=&contrain=0&image=file.jpg' My question is how do handle this in MVC? I tried this: public FileStreamResult Get(int? w, int? h, int? constrain, string image) which then gets an image from a file, does its calculations and resizing then outputs it like this: MemoryStream fs = new MemoryStream(); oThumbnail.Save(fs, jpegICI, encoderParams); return new FileStreamResult(fs, "image/jpeg"); But all that does is output a string: http://devserver/Thumb/Get/240/0/0/opel_ruhestaette.jpg. And if I view the source its: <img src=" http://devserver/Thumb/Get/240/0/0/opel_ruhestaette.jpg" border="0" /> So any ideas or help with this would be much appreciated. I have tried googling this, but found nothing yet. Thanks |
|
|
|
|
|
#2 |
|
SitePoint Wizard
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: Cape Town, South Africa
Posts: 1,587
|
Ok, I got it working thanks to this link: http://blogs.msdn.com/miah/archive/2...er-action.aspx
Didnt work out the box, but slight tweak got it to wat I can use. Is this a good way to do it? Or are there better ways of doing this in MVC? |
|
|
|
|
|
#3 |
|
ALT.NET - because we need it
![]() ![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jul 2001
Location: Scotland
Posts: 5,124
|
Looks ok, but there is s File() method that you can use to the same thing in the Controller.
|
|
|
|
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
| Display Modes | |
|
|
|
All times are GMT -7. The time now is 18:07.









Linear Mode
