Go Back   SitePoint Forums > Forum Index > Program Your Site > .NET
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old Jun 22, 2009, 01:37   #1
NightStalker-DNS
SitePoint Wizard
 
NightStalker-DNS's Avatar
 
Join Date: Jul 2004
Location: Cape Town, South Africa
Posts: 1,828
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
NightStalker-DNS is offline   Reply With Quote
 

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 02:08.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved