@@ -30,19 +30,7 @@ public async Task<IActionResult> ImageAsync(string id, string slug, int w, int h
3030 {
3131 Response . Headers . Add ( "Cache-Control" , $ "public, max-age={ TimeSpan . FromDays ( 1 ) . TotalSeconds } ") ;
3232 Response . Headers . Add ( "Access-Control-Allow-Origin" , "*" ) ;
33- return await ImageResult ( id , slug , w , h , quality , options ) ;
34- }
3533
36- [ HttpGet ( "/i/{slug}/{*filepath}" ) ]
37- public async Task < IActionResult > ImageFromFilePathAsync ( string filepath , string slug )
38- {
39- Response . Headers . Add ( "Cache-Control" , $ "public, max-age={ TimeSpan . FromDays ( 1 ) . TotalSeconds } ") ;
40- Response . Headers . Add ( "Access-Control-Allow-Origin" , "*" ) ;
41- return await ImageResult ( filepath , slug ) ;
42- }
43-
44- private async Task < IActionResult > ImageResult ( string id , string slug , int w = 0 , int h = 0 , int quality = 100 , string options = "" )
45- {
4634 if ( string . IsNullOrWhiteSpace ( id ) )
4735 {
4836 _logger . LogError ( "Id is null" ) ;
@@ -55,6 +43,19 @@ private async Task<IActionResult> ImageResult(string id, string slug, int w = 0,
5543 return new StatusCodeResult ( ( int ) HttpStatusCode . BadRequest ) ;
5644 }
5745
46+ return await ImageResult ( id , slug , w , h , quality , options ) ;
47+ }
48+
49+ [ HttpGet ( "/i/{slug}/{*filepath}" ) ]
50+ public async Task < IActionResult > ImageFromFilePathAsync ( string filepath , string slug )
51+ {
52+ Response . Headers . Add ( "Cache-Control" , $ "public, max-age={ TimeSpan . FromDays ( 1 ) . TotalSeconds } ") ;
53+ Response . Headers . Add ( "Access-Control-Allow-Origin" , "*" ) ;
54+ return await ImageResult ( filepath , slug ) ;
55+ }
56+
57+ private async Task < IActionResult > ImageResult ( string id , string slug , int w = 0 , int h = 0 , int quality = 100 , string options = "" )
58+ {
5859 byte [ ] bytes ;
5960 try
6061 {
0 commit comments