void CreateUrlQRCodeIMG() { Response.Cache.SetCacheability(HttpCacheability.Public); Response.Cache.SetMaxAge(TimeSpan.FromSeconds(600000)); Response.ContentType = "image/gif"; string link = Request.QueryString["url"] ?? string.Empty; if (string.IsNullOrEmpty(link)) { return; } link = HttpUtility.UrlDecode(link); QrEncoder qrEncoder = new QrEncoder(ErrorCorrectionLevel.H); QrCode qrCode = qrEncoder.Encode(link); GraphicsRenderer renderer = new GraphicsRenderer(new FixedModuleSize(8, QuietZoneModules.Four), Brushes.Black, Brushes.White); renderer.WriteToStream(qrCode.Matrix, ImageFormat.Gif, Response.OutputStream); }
原文地址:https://www.cnblogs.com/AlexLeeLi/p/10510488.html
时间: 2024-10-18 03:48:35