44using System . Linq ;
55using System . Security . Cryptography ;
66using System . Text ;
7- using Funq ;
87using ServiceStack . Common ;
98using ServiceStack . Common . Utils ;
109using ServiceStack . Common . Web ;
1110using ServiceStack . ServiceHost ;
1211using ServiceStack . ServiceInterface ;
1312using ServiceStack . Text ;
14- using ServiceStack . WebHost . Endpoints ;
1513using System . Drawing ;
1614using System . Drawing . Drawing2D ;
1715
@@ -67,7 +65,7 @@ public object Post(Upload request)
6765 }
6866 }
6967
70- return HttpResult . Redirect ( "/ImageResizer/ " ) ;
68+ return HttpResult . Redirect ( "/" ) ;
7169 }
7270
7371 private void WriteImage ( Stream ms )
@@ -168,13 +166,11 @@ public static Image Crop(Image Image, int newWidth, int newHeight, int startX =
168166 g . PixelOffsetMode = PixelOffsetMode . HighQuality ;
169167 g . DrawImage ( Image , new Rectangle ( 0 , 0 , newWidth , newHeight ) , startX , startY , newWidth , newHeight , GraphicsUnit . Pixel ) ;
170168
171- using ( var ms = new MemoryStream ( ) )
172- {
173- bmp . Save ( ms , ImageFormat . Png ) ;
174- Image . Dispose ( ) ;
175- var outimage = Image . FromStream ( ms ) ;
176- return outimage ;
177- }
169+ var ms = new MemoryStream ( ) ;
170+ bmp . Save ( ms , ImageFormat . Png ) ;
171+ Image . Dispose ( ) ;
172+ var outimage = Image . FromStream ( ms ) ;
173+ return outimage ;
178174 }
179175 }
180176 }
@@ -183,21 +179,7 @@ public object Any(Reset request)
183179 {
184180 Directory . GetFiles ( UploadsDir ) . ToList ( ) . ForEach ( File . Delete ) ;
185181 Directory . GetFiles ( ThumbnailsDir ) . ToList ( ) . ForEach ( File . Delete ) ;
186- return HttpResult . Redirect ( "/ImageResizer/" ) ;
187- }
188- }
189-
190- public class AppHost : AppHostBase
191- {
192- public AppHost ( ) : base ( "Image Resizer" , typeof ( AppHost ) . Assembly ) { }
193- public override void Configure ( Container container ) { }
194- }
195-
196- public class Global : System . Web . HttpApplication
197- {
198- protected void Application_Start ( object sender , EventArgs e )
199- {
200- new AppHost ( ) . Init ( ) ;
182+ return HttpResult . Redirect ( "/" ) ;
201183 }
202184 }
203185}
0 commit comments