2013-03-27 7 views
1

MessagingToolkit.QRCode.dll 버튼을 클릭하여 QR 코드 이미지를 만들었습니다. 디스크에 이미지를 저장했습니다. 보기와는 별도로 이미지를 팝업으로 표시하는 방법 ?? 여기보기에서 이미지를 표시하는 방법

[HttpPost] 
public ActionResult GenerateQR(string Command, FormCollection collection) 
    { 
    // qr code logic // 
     QRCodeEncoder encoder = new QRCodeEncoder(); 
     Bitmap img = encoder.Encode(qrcode); 
     img.Save(@"D:\\Capture.png", ImageFormat.Jpeg); 
    // Checking the image present in the filepath and displaying the image. 
     string filePath = @"D:\\Capture.png"; 
     if (!System.IO.File.Exists(filePath)) 
      return Content("<script language='javascript' type='text/javascript'>alert('The Image is not available.');</script>"); 
     else 
      return new FilePathResult(filePath, "image/png"); 
    } 

이미지가 완전히보기에 표시됩니다 :
여기 내 컨트롤러 코드입니다. 보기와 별도의 팝업으로 이미지를 표시하는 방법.

+0

jquery popup 및 ajax 호출 사용 – Sharun

답변

0

팝업 대신 가져 오는 대신 아래 코드를 사용하여 직접 이미지를 얻었습니다.

QRCodeEncoder encoder = new QRCodeEncoder(); 
Bitmap img = encoder.Encode(qrcode); 
string path = Server.MapPath(@"/Images/QRCode.jpg");   
img.Save(path, ImageFormat.Jpeg);   
return base.File(path,"image/jpeg","QRCode.jpg");