|  |  | 
          
            | Code (PHP) ผมอยากทราบว่าส่วนไหนของโค้ดที่เป็นคำสั่งในการสร้างภาพ qr ครับ ผมจะวนลูปให้มันสร้างทีล่ะเยอะๆๆ รบกวนด้วยครับอ่านเองแล้วไม่เข้าใจจริงๆๆ ลองผิดลองถูกก็ไม่ได้ ช่วยหน่อยน่ะครับ แค่แนะนำก็ได้ครับ
 
 //set it to writable location, a place for temp generated PNG files
    $PNG_TEMP_DIR = dirname(__FILE__).DIRECTORY_SEPARATOR.'phpqrcode/temp'.DIRECTORY_SEPARATOR;
    
    //html PNG location prefix
    $PNG_WEB_DIR = 'phpqrcode/temp/';
    include "phpqrcode/qrlib.php";    
    
    //ofcourse we need rights to create temp dir
    if (!file_exists($PNG_TEMP_DIR))
        mkdir($PNG_TEMP_DIR);
    
    $filename = $PNG_TEMP_DIR.'QR_BonusPoint.png';
     
    //processing form input
    //remember to sanitize user input in real-life solution !!!
    $errorCorrectionLevel = 'L';
    if (isset($_REQUEST['level']) && in_array($_REQUEST['level'], array('L','M','Q','H')))
        $errorCorrectionLevel = $_REQUEST['level'];    
    $matrixPointSize = 4;
    if (isset($_REQUEST['size']))
        $matrixPointSize = min(max((int)$_REQUEST['size'], 1), 10);
    if (isset($_REQUEST['data'])) { 
    
        //it's very important!
        if (trim($_REQUEST['data']) == '')
            die('data cannot be empty! <a href="?">back</a>');
            
        // user data
		
        $filename = $PNG_TEMP_DIR.'QR_BonusPoint'.md5($_REQUEST['data'].'|'.$errorCorrectionLevel.'|'.$matrixPointSize).'.png';
        QRcode::png($_REQUEST['data'], $filename, $errorCorrectionLevel, $matrixPointSize, 2);    
       	$QRname_Pic='QR_BonusPoint'.md5($_REQUEST['data'].'|'.$errorCorrectionLevel.'|'.$matrixPointSize).'.png';
    } else {    
    
        //default data
          
        QRcode::png('PHP QR Code :)', $filename, $errorCorrectionLevel, $matrixPointSize, 2);    
        
    }
 
 
 Tag : PHP, HTML/CSS
 
 
 |  
            | 
 ประวัติการแก้ไข
 2012-01-16 02:07:58
 |  
            | 
              
                |  |  |  |  
                |  | 
                    
                      | Date :
                          2012-01-16 02:06:52 | By :
                          gmgo | View :
                          1021 | Reply :
                          1 |  |  |  
                |  |  |  |  |  
            |  |  
		            |  |