protected void Page_Load(object sender, EventArgs e) { String key = Request["key"]; String orderby = "interestingness-desc"; if (String.IsNullOrEmpty(key)) { return; } cache = CacheFactory.GetCache(); currentCacheKey = key + orderby; object result = cache.get(currentCacheKey); if (result == null) { FlickrFetcher fetcher = new FlickrFetcher(); fetched(fetcher.FetchGroup(key, "")); } else { AjaxResponse response = new AjaxResponse(); response.Status = "OK"; response.RawData = result; Response.Write(response.ToString()); } Response.ContentType = "application/json"; }
public void ProcessRequest(HttpContext context) { this._context = context; String key = this._context.Request["key"]; String orderby = "interestingness-desc"; if (String.IsNullOrEmpty(key)) { return; } cache = CacheFactory.GetCache(); currentCacheKey = key + orderby; object result = cache.get(currentCacheKey); if (result == null) { FlickrFetcher fetcher = new FlickrFetcher(); fetched(fetcher.Fetch(key, orderby)); } else { AjaxResponse response = new AjaxResponse(); response.Status = "OK"; response.RawData = result; _context.Response.Write(response.ToString()); } context.Response.ContentType = "application/json"; }
private String tilerInternalToBase64Jpeg(string keyword, int w, int count, String orderby) { FlickrFetcher fetcher = new FlickrFetcher(); //75x75 filckr s for tiles List <FlickrPhoto> result = fetcher.Fetch(HttpUtility.UrlEncode(keyword), orderby, "s"); List <String> urls = result.Take(count).Select(x => x.Url).ToList <String>(); FlickrImageTiler tiler = new FlickrImageTiler(); Bitmap bmp = (Bitmap)tiler.tiler(urls, 5); String base64 = Citiport.Util.DataUtil.ImageToBase64(bmp, System.Drawing.Imaging.ImageFormat.Jpeg); return(base64); }
public String GetFirst(String tags, String orderby, String size) { FlickrFetcher urlsfetcher = new FlickrFetcher(); //75x75 filckr s for tiles List <FlickrPhoto> result = urlsfetcher.Fetch(HttpUtility.UrlEncode(tags), orderby, size); List <String> urls = new List <String>() { result[5].Url }; List <Image> image = fetcher.fetch(urls); String base64 = Citiport.Util.DataUtil.ImageToBase64(image[0], System.Drawing.Imaging.ImageFormat.Jpeg); return(base64); }