Exemple #1
0
 public function encodeJPG($intext, $outfile = false, $saveandprint = false)
 {
     try {
         ob_start();
         $tab = $this->encode($intext);
         $err = ob_get_contents();
         ob_end_clean();
         if ($err != '') {
             QRtools::log($outfile, $err);
         }
         $maxSize = (int) (QR_PNG_MAXIMUM_SIZE / (count($tab) + 2 * $this->margin));
         QRimage::jpg($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin, $saveandprint);
     } catch (Exception $e) {
         QRtools::log($outfile, $e->getMessage());
     }
 }
            $out[] = '';
        } else {
            $out[] = $matches[0][3];
        }
    }
    return $out;
}
// validate signature
list($key, $salt) = qsot_fetch_defines(array('NONCE_KEY', 'NONCE_SALT'), $d['p']);
$test = sha1($key . @json_encode($d) . $salt);
if ($test != $sig) {
    die($debug ? '<!-- hash mismatch : ' . $sig . ' / ' . $test . ' -->' : '');
}
// end abuse protection
include_once 'qrlib.php';
//QRCode::png($d, false, 'L', 3, 1);
$enc = QRencode::factory('L', 3, 1);
$outfile = false;
try {
    ob_start();
    $tab = $enc->encode($d['d']);
    $err = ob_get_contents();
    ob_end_clean();
    if ($err != '') {
        QRtools::log($outfile, $err);
    }
    $maxSize = (int) (QR_PNG_MAXIMUM_SIZE / (count($tab) + 2 * $enc->margin));
    QRimage::jpg($tab, $outfile, 2.5, $enc->margin, 100);
} catch (Exception $e) {
    QRtools::log($outfile, $e->getMessage());
}