예제 #1
0
        public ActionResult GetChargeVoucherImage([FromRoute] int id, [FromQuery] string operationCode)
        {
            var url   = _urlManager.GetChargeVoucherHtmlUrl(id, operationCode);
            var image = UrlToImage.DownloadContentAsImage(url);

            return(File(image, "image/jpeg"));
        }
예제 #2
0
        public async Task <IActionResult> ToImage(string url = "/Home/Index")
        {
            url = string.Format("{0}://{1}{2}", HttpContext.Request.Scheme, HttpContext.Request.Host, url);
            var image = new UrlToImage(url);
            await image.SaveFileAsync(Path.Combine("wwwroot/files/image", DateTime.Now.ToString("yyyyMMddhhmmss") + ".png"));

            return(Content("ok"));
        }
예제 #3
0
 public override int GetHashCode()
 {
     unchecked
     {
         int hashCode = (Source != null ? Source.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Author != null ? Author.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Title != null ? Title.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Url != null ? Url.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (UrlToImage != null ? UrlToImage.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ PublishedAt.GetHashCode();
         return(hashCode);
     }
 }
예제 #4
0
 /// <summary>
 ///     This endpoint lets you to convert any publicly accessible URL into an Image.
 /// </summary>
 /// <param name="urlToImageParams">Url to Image parameters.</param>
 /// <returns>Returns a ReturnResponse type</returns>
 public Task <ReturnResponse> UrlToImage(UrlToImage urlToImageParams)
 {
     return(SendRequest(urlToImageParams));
 }
예제 #5
0
        public void Path_IsCorrect()
        {
            var urlToImage = new UrlToImage();

            Assert.AreEqual("url/image", urlToImage.Path);
        }