public function encodePNG($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::png($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin, $saveandprint); } catch (Exception $e) { QRtools::log($outfile, $e->getMessage()); } }
public function encodeJPG($intext, $outfile = false, $q = 85, $rgb_color = '0,0,0', $rgb_bg_color = '255,255,255') { try { ob_start(); $tab = $this->encode($intext); $err = ob_get_contents(); ob_end_clean(); if ($err != '') { QRtools::log($outfile, $err); } $maxSize = (int) (QR_JPG_MAXIMUM_SIZE / (count($tab) + 2 * $this->margin)); QRimage::jpg($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin, $q, $rgb_color, $rgb_bg_color); } catch (Exception $e) { QRtools::log($outfile, $e->getMessage()); } }
protected static function _qr_img($data) { require_once self::$o->core_dir . 'libs/phpqrcode/qrlib.php'; require_once self::$o->core_dir . 'libs/phpqrcode/qsot-qrimage.php'; ob_start(); // create the encoder $enc = QRencode::factory('L', 3, 1); $outfile = false; try { // attempt to encode the data ob_start(); $tab = $enc->encode($data); $err = ob_get_contents(); ob_end_clean(); // log any errors produced if ($err != '') { QRtools::log($outfile, $err); } // calculate the dimensions of the image $maxSize = (int) (QR_PNG_MAXIMUM_SIZE / (count($tab) + 2 * $enc->margin)); // render the image $img_data = QSOT_QRimage::jpg_base64($tab, 2.5, $enc->margin, 100); } catch (Exception $e) { $img_data = array('data:image/jpeg;base64,', 0, 0); // log any exceptions QRtools::log($outfile, $e->getMessage()); } return $img_data; }
$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()); }