c# - ImageResizer not touching file from webapi 2 controller -


i've read post:

imageresizer not resizing images served webapi

and i've read associated faq talks webapi , imageresizer here:

http://imageresizing.net/docs/best-practices

i'm still not understanding need make files served route:

config.routes.maphttproute          ("api vimeo thumbnail", "rpc/{controller}/{action}/{vimeoid}.jpg",              new              {               }); 

and handled controller:

public class vimeocontroller : apicontroller     {         [httpget]         [actionname("thumbnail")]         public httpresponsemessage thumbnail(string vimeoid = null, int? width = 1280, int? height = 720)         {             string url = string.format("https://vimeo.com/api/oembed.json?url=https%3a//vimeo.com/{0}&width={1}&height={2}", vimeoid, width,                 height);             var endpointrequest = (httpwebrequest) webrequest.create(url);             endpointrequest.method = "get";             endpointrequest.accept = "application/json;odata=verbose";             //var endpointresponse = (httpwebresponse) endpointrequest.getresponse();             var result = new httpresponsemessage(httpstatuscode.ok);             try             {                 using (webresponse webresponse = endpointrequest.getresponse())                 {                     using (stream webstream = webresponse.getresponsestream())                     {                         using (var responsereader = new streamreader(webstream))                         {                             string response = responsereader.readtoend();                             var reader = new jsontextreader(new stringreader(response));                             while (reader.read())                             {                                 if (reader.value != null && reader.value.equals("thumbnail_url"))                                 {                                     reader.read();                                     string downloadurl = reader.value.tostring();                                     var wc = new webclient();                                     using (var stream = new memorystream(wc.downloaddata(downloadurl)))                                     {                                         result.content = new bytearraycontent(stream.toarray());                                         result.content.headers.contenttype = new mediatypeheadervalue("image/png");                                     }                                 }                             }                             responsereader.close();                         }                     }                 }             }             catch (exception e)             {                 console.out.writeline(e.message);                 console.readline();             }             return result;         }     } 

what confuses me how imageresizer picks files in /images directory not handler. i'm not understanding pipeline , how it.

imageresizer not work way; operates prior handlerequest phase in order take advantage of iis static file serving. must subclass blobproviderbase or implement ivirtualimageprovider if want provide custom behavior. if need http request, might try remotereader plugin (and url rewriting if want change syntax).

see integrating custom data store more information.


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -