using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using System.Text;
using System.Drawing;
using ThoughtWorks.QRCode.Codec;
using ThoughtWorks.QRCode.Codec.Data;
using ThoughtWorks.QRCode.Codec.Util;

/// <summary>
///二维码生成器
/// </summary>
public class QRCodeMaker
{

    public string CreatePhoneSiteQRCode(string nr)
    {
        Bitmap bt;
        string enCodeString = nr;
        QRCodeEncoder qrCodeEncoder = new QRCodeEncoder();
        qrCodeEncoder.QRCodeScale = 8;
        qrCodeEncoder.QRCodeVersion =4;
        bt = qrCodeEncoder.Encode(enCodeString, Encoding.UTF8);
        
        string filename = "qrcode_phone_site.jpg";
        bt.Save(HttpContext.Current.Server.MapPath("../../Upload/") + filename);
        string qr_code_url = "Upload/" + filename;
        return qr_code_url;
    }
}