public static function genqrm($nombre, $ap, $am, $com, $filename) { $QR_TEMP_DIR = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'qrimg' . DIRECTORY_SEPARATOR; $HTML_TEMP_DIR = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'html' . DIRECTORY_SEPARATOR; $QR_WEB_DIR = "qrimg/"; $HTML_WEB_DIR = "html/"; include "phpqrcode.php"; if (!file_exists($QR_TEMP_DIR)) { mkdir($QR_TEMP_DIR); } if (!file_exists($HTML_TEMP_DIR)) { mkdir($HTML_TEMP_DIR); } $fileimg = $QR_TEMP_DIR . 'test.png'; $errorCorrectionLevel = 'Q'; $matrixPointSize = 6; $filenameqr = $QR_WEB_DIR . $filename; $filenamehtml = $HTML_WEB_DIR . $filename; $fileimg = $filenameqr . '.png'; $filehtml = $filenamehtml . '.html'; $filehtmlqr = "192.168.1.5/demo/qr/" . $filehtml; QRcode::png($filehtmlqr, $fileimg, $errorCorrectionLevel, $matrixPointSize, 2); $mensaje = "\n\n <!DOCTYPE html>\n <html>\n <head>\n\n <title></title>\n </head>\n <body>\n\n Nombre: '{$nombre}' '{$ap}' '{$am}' <br><br>\n Comentario: '{$com}'\n\n </body>\n </html>\n\n "; if ($archivo = fopen($filehtml, "a")) { fwrite($archivo, $mensaje); fclose($archivo); } echo '<img src="' . $QR_WEB_DIR . basename($fileimg) . '" /> <br>Datos guardados <a href="./index.php">Regresar</a><br>'; return $fileimg; }
public function qrcode() { import('Com.Wxpay.example.phpqrcode.phpqrcode', LIB_PATH, '.php'); $url = base64_decode($_GET["data"]); \QRcode::png($url, false, QR_ECLEVEL_L, 9, 2); exit; }
public function createQR() { $info = collectinfo(__METHOD__, '', array()); $qr = M('qr'); //先取一个tempuid $tmpuid = time() . rand(10, 99); //加上随机数几乎是杜绝了统一时间一起产生的临时uid的可能性 $this->assign('tmpuid', $tmpuid); $isscan = 0; $openid = ''; $data = array('tmpuid' => $tmpuid, 'isscan' => $isscan, 'openid' => $openid); $qr->data($data)->add(); $pic = './Public/img/qr/' . $tmpuid . '.png'; $url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx682ad2cc417fe8b9&redirect_uri=http://www.evchar.cn/evcpc/oauth2_openid.php&response_type=code&scope=snsapi_base&state=" . $tmpuid . "&connect_redirect=1#wechat_redirect"; include "phpqrcode.php"; $c = $url; $data = 'http://www.baidu.com'; // 纠错级别:L、M、Q、H $level = 'L'; // 点的大小:1到10,用于手机端4就可以了 $size = 4; // 下面注释了把二维码图片保存到本地的代码,如果要保存图片,用$fileName替换第二个参数false //$path = "images/"; // 生成的文件名 //$fileName = $path.$size.'.png'; //只认从根目录去找的。。 QRcode::png($c, $pic, $level, $size); $this->assign('pic', $pic); return createarrok('ok', $pic, '', $info); }
public function action_generate() { $basePath = DOCROOT; $embedLogo = true; $logoFilePath = "{$basePath}uploads/tmp/qrcode/logo.png"; //二维码内容 $content = \Input::get('content', ''); //保存路径 $savePath = 'uploads/tmp/qrcode/'; //容错级别(L | M | Q | H) $errLevel = 0; //二维码尺寸(1 ~ 10) $size = 10; //空白边距 $margin = 2; $name = time(); $qrFilePath = "{$basePath}{$savePath}{$name}.png"; \QRcode::png($content, $qrFilePath, $errLevel, $size, $margin); $QRFile = imagecreatefromstring(file_get_contents($qrFilePath)); // 是否嵌入Logo if ($embedLogo) { $this->embedLogo($QRFile, $logoFilePath); } //保存为图片 //imagepng($QRFile, $qrFilePath); //输出图片流 imagepng($QRFile); }
public function init(){ //ofcourse we need rights to create temp dir if (!file_exists($this->pngTempDir)) mkdir($this->pngTempDir); if ($this->date != 'shopnc') { // user data if ($this->pngTempName != '') { $filename = $this->pngTempDir.$this->pngTempName; } else { $filename = $this->pngTempDir.'test'.md5($this->date.'|'.$this->errorCorrectionLevel.'|'.$this->matrixPointSize).'.png'; } QRcode::png($this->date, $filename, $this->errorCorrectionLevel, $this->matrixPointSize, 2); } else { //default data QRcode::png('http://www.ejiao2o.com', $filename, $this->errorCorrectionLevel, $this->matrixPointSize, 2); } //display generated file return basename($filename); QRtools::timeBenchmark(); }
public function qrAction() { $url = I('get.raw'); $url = base64_decode($url); import_third('qrcode.phpqrcode'); \QRcode::png($url, false, QR_ECLEVEL_Q, 8); }
/** * function description * * @param * @return void */ public function execute($request) { $id = $request->id; if (empty($id)) { header("Location: " . SP_URL_HOME); exit; } $data = Sp_Account_Attendee::getAttendeeBySn($id); if (empty($data)) { header("Location: " . SP_URL_HOME); exit; } if ($request->type == 'code') { include LIB_ROOT . 'third/phpqrcode/qrlib.php'; $errorCorrectionLevel = "L"; $matrixPointSize = "6"; QRcode::png($id, false, $errorCorrectionLevel, $matrixPointSize); } else { $active = Sp_Active_Active::getActiveById($data['activeId']); if (empty($active)) { $this->show404(); } $data['sn'] = $this->formatSn($data['signId']); $view = new Sp_View(); $view->assign('data', $data); $view->assign('active', $active); $view->display("attendee/code.html"); } }
public static function createImg($content, $qrc_level = 'H', $qrc_size = 10, $logo = FALSE, $savePath = null) { include_once 'phpqrcode.php'; // if($savePath) $QR = QRcode::png($content, $savePath, $qrc_level, $qrc_size, 2); if ($logo !== FALSE) { $QR = imagecreatefromstring(file_get_contents($savePath)); $logo = imagecreatefromstring(file_get_contents($logo)); $QR_width = imagesx($QR); // 二维码图片宽度 $QR_height = imagesy($QR); // 二维码图片高度 $logo_width = imagesx($logo); // logo图片宽度 $logo_height = imagesy($logo); // logo图片高度 $logo_qr_width = $QR_width / 5; $scale = $logo_width / $logo_qr_width; $logo_qr_height = $logo_height / $scale; $from_width = ($QR_width - $logo_qr_width) / 2; // 重新组合图片并调整大小 imagecopyresampled($QR, $logo, $from_width, $from_width, 0, 0, $logo_qr_width, $logo_qr_height, $logo_width, $logo_height); } return $QR; }
public function logo() { Vendor("phpqrcode.phpqrcode"); $QRcode = new \QRcode(); $path = "data/rq/"; $value = 'http://' . $_SERVER['HTTP_HOST'] . '/index.php?token=' . session('token'); $fileName = $path . session('token') . '_emall.png'; $QR_Logo = $path . session('token') . '_emall_Logo.png'; $errorCorrectionLevel = 'H'; $matrixPointSize = 10; $QRcode->png($value, $fileName, $errorCorrectionLevel, $matrixPointSize, 2); $logo = $path . 'weixinlogo.jpg'; $QR = $fileName; if ($logo !== FALSE) { $QR = imagecreatefromstring(file_get_contents($QR)); $logo = imagecreatefromstring(file_get_contents($logo)); $QR_width = imagesx($QR); $QR_height = imagesy($QR); $logo_width = imagesx($logo); $logo_height = imagesy($logo); $logo_qr_width = $QR_width / 5; $scale = $logo_width / $logo_qr_width; $logo_qr_height = $logo_height / $scale; $from_width = ($QR_width - $logo_qr_width) / 2; imagecopyresampled($QR, $logo, $from_width, $from_width, 0, 0, $logo_qr_width, $logo_qr_height, $logo_width, $logo_height); } imagepng($QR, $QR_Logo); $this->assign('QR_Logo', $QR_Logo); $this->display(); if (IS_AJAX) { $response = $this->fetch(); $this->ajaxReturn(1, '', $response); } }
/** * 生成QRCode */ function generateQRCode($itemProduct) { //在这里要确保 products文件夹中apk名字 与 数据库名字一样 $qrCodeHref = DOMAIN . '/products' . '/' . $itemProduct['download']; define('QR_NAME', 'itemQRCode.png'); QRcode::png($qrCodeHref, QR_NAME, 'L', 5.5); }
function getQRCode($name, $secret) { global $tempDir; $url = 'otpauth://totp/' . $name . '?secret=' . $secret . ''; QRcode::png($url, $tempDir . $secret . ".png", QR_ECLEVEL_L, 10); return $tempDir . $secret . ".png"; }
public function fieldsFormDisplay($rid = 0) { global $_W; if (!empty($rid)) { $reply = pdo_fetch("SELECT * FROM " . tablename('bm_qrsign_reply') . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid)); if (empty($reply['qrcode'])) { if ($reply['qrtype'] == 0) { $value = $_W['siteroot'] . 'app/' . $this->createmobileurl('sign', array('rid' => $rid)); $errorCorrectionLevel = 'H'; $matrixPointSize = '16'; $rand_file = rand() . '.png'; $att_target_file = 'qr-' . $rand_file; $target_file = '../addons/bm_qrsign/tmppic/' . $att_target_file; QRcode::png($value, $target_file, $errorCorrectionLevel, $matrixPointSize); $reply['qrcode'] = $target_file; } else { $value = $_W['siteroot'] . 'app/' . $this->createmobileurl('pay', array('rid' => $rid)); $errorCorrectionLevel = 'H'; $matrixPointSize = '16'; $rand_file = rand() . '.png'; $att_target_file = 'qr-' . $rand_file; $target_file = '../addons/bm_qrsign/tmppic/' . $att_target_file; QRcode::png($value, $target_file, $errorCorrectionLevel, $matrixPointSize); $reply['qrcode'] = $target_file; } } } load()->func('tpl'); include $this->template('form'); }
public function generate($params = array()) { if (isset($params['black']) && is_array($params['black']) && count($params['black']) == 3 && array_filter($params['black'], 'is_int') === $params['black']) { QRimage::$black = $params['black']; } if (isset($params['white']) && is_array($params['white']) && count($params['white']) == 3 && array_filter($params['white'], 'is_int') === $params['white']) { QRimage::$white = $params['white']; } $params['data'] = isset($params['data']) ? $params['data'] : 'QR Code Library'; if (isset($params['savename'])) { $level = 'L'; if (isset($params['level']) && in_array($params['level'], array('L', 'M', 'Q', 'H'))) { $level = $params['level']; } $size = 4; if (isset($params['size'])) { $size = min(max((int) $params['size'], 1), 10); } QRcode::png($params['data'], $params['savename'], $level, $size, 2); return $params['savename']; } else { $level = 'L'; if (isset($params['level']) && in_array($params['level'], array('L', 'M', 'Q', 'H'))) { $level = $params['level']; } $size = 4; if (isset($params['size'])) { $size = min(max((int) $params['size'], 1), 10); } QRcode::png($params['data'], NULL, $level, $size, 2); } }
/** * @param $type * @param $text * @param $file * @param array $options * @return bool */ public function saveAs($type, $text, $file, $options = array()) { @unlink($file); switch ($type) { case $type == 'qr': include_once __DIR__ . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "Resources" . DIRECTORY_SEPARATOR . "phpqrcode" . DIRECTORY_SEPARATOR . "qrlib.php"; $level = isset($options['level']) ? $options['level'] : QR_ECLEVEL_L; $size = isset($options['size']) ? $options['size'] : 3; $margin = isset($options['margin']) ? $options['margin'] : 4; \QRcode::png($text, $file, $level, $size, $margin); if (isset($options['useOverlay']) && $options['useOverlay']) { $this->addOverlay($file, $size); } break; case is_numeric($type): $type = $this->types[$type]; default: $barcodeOptions = array_merge(isset($options['barcodeOptions']) ? $options['barcodeOptions'] : array(), array('text' => $text)); $rendererOptions = isset($options['rendererOptions']) ? $options['rendererOptions'] : array(); $rendererOptions['width'] = isset($rendererOptions['width']) ? $rendererOptions['width'] : 2233; $rendererOptions['height'] = isset($rendererOptions['height']) ? $rendererOptions['height'] : 649; $image = new Image($imageResource = Barcode::factory($type, 'image', $barcodeOptions, $rendererOptions)->draw()); $image->save($file); } return true; }
public function QRcode() { include "./weimicms/Lib/ORG/phpqrcode.php"; $viewUrl = C("site_url") . U("Wap/Index/index", array("token" => $this->token)); $url = urldecode($viewUrl); QRcode::png($url, false, 0, 8); }
/** * Create QRCODE 生成二维码的方法 * * @return false :该文件存在; true:生成二维码成功。 */ public function createQr() { if ($this->data) { if ($this->fileName !== false && file_exists($this->fileName)) { return false; } QRcode::png($this->data, $this->fileName, $this->ecc, $this->size); if ($this->logo != null) { $QR = $this->fileName; $dd = file_get_contents($QR); $QR = imagecreatefromstring(file_get_contents($QR)); $logo = imagecreatefromstring(file_get_contents($this->logo)); $QR_width = imagesx($QR); $QR_height = imagesy($QR); $logo_width = imagesx($logo); $logo_height = imagesy($logo); $logo_qr_width = $QR_width / 5; $scale = $logo_width / $logo_qr_width; $logo_qr_height = $logo_height / $scale; $from_width = ($QR_width - $logo_qr_width) / 2; imagecopyresampled($QR, $logo, $from_width, $from_width, 0, 0, $logo_qr_width, $logo_qr_height, $logo_width, $logo_height); imagepng($QR, $this->fileName); } return true; } }
public function build($text, $prefix, $token, $args = array()) { $matrixPointSize = 5; $targetFolder = $this->png_dir . $token . '/d2/'; if (!is_dir($_SERVER['DOCUMENT_ROOT'] . $this->png_dir)) { mkdir($_SERVER['DOCUMENT_ROOT'] . $this->png_dir); } if (!is_dir($_SERVER['DOCUMENT_ROOT'] . $this->png_dir . $token)) { mkdir($_SERVER['DOCUMENT_ROOT'] . $this->png_dir . $token); } if (!is_dir($_SERVER['DOCUMENT_ROOT'] . $this->png_dir . $token . '/d2/')) { mkdir($_SERVER['DOCUMENT_ROOT'] . $this->png_dir . $token . '/d2/'); } $filename = 'qr_' . $prefix . '_' . $matrixPointSize . '_' . md5($text . '|' . $this->error_correction_level . '|' . $matrixPointSize . '|' . $token) . '.png'; $this->dest_url = $targetFolder . $filename; Log::write('path:' . $this->dest_url); if ($args) { if (!isset($args['out_file'])) { $args['out_file'] = $_SERVER['DOCUMENT_ROOT'] . $targetFolder . $filename; } create_qr($text, $args); } else { QRcode::png($text, $_SERVER['DOCUMENT_ROOT'] . $targetFolder . $filename, $this->error_correction_level, $matrixPointSize, 2); } }
public function QRcode() { include './PigCms/Lib/ORG/phpqrcode.php'; $viewUrl = C('site_url') . U('Wap/Index/index', array('token' => $this->token)); $url = urldecode($viewUrl); QRcode::png($url, false, 0, 8); }
function mark_phpqrcode($filename = "", $thisurl = '') { $uid = $this->Session->read('User.uid'); if (empty($filename)) { $filename = SYS_PATH_PHOTOS . 'qcody' . DS . $uid . DS . $filename; } include SYS_PATH . 'inc/phpqrcode.php'; // 二维码数据 $issubscribe = 0; if (empty($thisurl)) { if ($uid > 0) { $sql = "SELECT is_subscribe FROM `{$this->App->prefix()}user` WHERE user_id = '{$uid}' LIMIT 1"; $issubscribe = $this->App->findvar($sql); } if ($issubscribe == '0') { $to_wecha_id = $this->get_user_parent_uid(); $thisurl = ADMIN_URL . "?toid=" . $to_wecha_id . "&tid=" . $uid; } else { $thisurl = ADMIN_URL . "?tid=" . $uid; } } // 生成的文件名 Import::fileop()->checkDir($filename); // 纠错级别:L、M、Q、H $errorCorrectionLevel = 'L'; // 点的大小:1到10 $matrixPointSize = 6; QRcode::png($thisurl, $filename, $errorCorrectionLevel, $matrixPointSize, 2); }
/** * Account sign up * * @access public * @return void */ function index() { // Enable SSL? maintain_ssl($this->config->item("ssl_enabled")); // Redirect signed in users to homepage if ($this->authentication->is_signed_in()) { redirect(''); } // Check recaptcha $recaptcha_result = $this->recaptcha->check(); // Store recaptcha pass in session so that users only needs to complete captcha once if ($recaptcha_result === TRUE) { $this->session->set_userdata('sign_up_recaptcha_pass', TRUE); } // Setup form validation $this->form_validation->set_error_delimiters('<span class="field_error">', '</span>'); $this->form_validation->set_rules(array(array('field' => 'sign_up_username', 'label' => 'lang:sign_up_username', 'rules' => 'trim|required|alpha_dash|min_length[2]|max_length[24]'), array('field' => 'sign_up_password', 'label' => 'lang:sign_up_password', 'rules' => 'trim|required|min_length[6]'), array('field' => 'sign_up_email', 'label' => 'lang:sign_up_email', 'rules' => 'trim|required|valid_email|max_length[160]'))); // Run form validation if ($this->form_validation->run() === TRUE && $this->config->item("sign_up_enabled")) { // Check if user name is taken if ($this->username_check($this->input->post('sign_up_username')) === TRUE) { $data['sign_up_username_error'] = lang('sign_up_username_taken'); } elseif ($this->email_check($this->input->post('sign_up_email')) === TRUE) { $data['sign_up_email_error'] = lang('sign_up_email_exist'); } elseif (!($this->session->userdata('sign_up_recaptcha_pass') == TRUE || $recaptcha_result === TRUE) && $this->config->item("sign_up_recaptcha_enabled") === TRUE) { $data['sign_up_recaptcha_error'] = $this->input->post('recaptcha_response_field') ? lang('sign_up_recaptcha_incorrect') : lang('sign_up_recaptcha_required'); } else { // Remove recaptcha pass $this->session->unset_userdata('sign_up_recaptcha_pass'); // Create user $user_id = $this->account_model->create($this->input->post('sign_up_username', TRUE), $this->input->post('sign_up_email', TRUE), $this->input->post('sign_up_password', TRUE)); // Add user details (auto detected country, language, timezone) $this->account_details_model->update($user_id); // Create folder for specific user if not found if (!file_exists(RES_DIR . "/user/" . $user_id)) { mkdir(RES_DIR . "/user/" . $user_id); copy(RES_DIR . "/user/index.html", RES_DIR . "/user/" . $user_id . "/index.html"); } // Generate QR Code if (!file_exists(RES_DIR . "/user/" . $user_id . "/qr-" . $user_id . ".png")) { include RES_DIR . '/adminlte/plugins/qrcode/phpqrcode/qrlib.php'; QRcode::png("#" . $user_id . "#" . $this->input->post('sign_up_username', TRUE) . "#" . $this->input->post('sign_up_email', TRUE), RES_DIR . "/user/" . $user_id . "/qr-" . $user_id . ".png", "H", 10, 2); } // Auto sign in? if ($this->config->item("sign_up_auto_sign_in")) { // Run sign in routine $this->authentication->sign_in($user_id); } redirect('account/sign_in'); } } // Load recaptcha code if ($this->config->item("sign_up_recaptcha_enabled") === TRUE) { if ($this->session->userdata('sign_up_recaptcha_pass') != TRUE) { $data['recaptcha'] = $this->recaptcha->load($recaptcha_result, $this->config->item("ssl_enabled")); } } // Load sign up view $this->load->view('sign_up', isset($data) ? $data : NULL); }
function createQrPng($firstName, $lastName, $id) { $filename = ABSPATH . 'qr/' . $id . '-' . $firstName . '-' . $lastName . '.png'; $size = 6; $margin = 1; QRcode::png($id, $filename, "L", $size, $margin); //create the blank image $im = imagecreatefrompng($filename); $width = imagesx($im); $height = imagesy($im); //setting up variables for putting text on the image $fontfile = ABSPATH . "my-includes/fonts/Avenir Next Condensed.ttc"; $string = $firstName . " " . $lastName; $fontsize = 16; $bbox = imagettfbbox($fontsize, 0, $fontfile, $string); $text_width = $bbox[4] - $bbox[0]; $maxchars = 40; $margin = 20; //10 pixels each side //adjust fontsize for size of text until it fits while ($text_width + $margin > $width) { $fontsize -= 1; $bbox = imagettfbbox($fontsize, 0, $fontfile, $string); $text_width = $bbox[4] - $bbox[0]; } //Set up the canvas with the size and black fill $newwidth = 144; $newheight = 216; $bordersize = 1; $wwidth = $newwidth - 2 * $bordersize; $wheight = $newheight - 2 * $bordersize; $white_space = imagecreatetruecolor($wwidth, $wheight); $output = imagecreatetruecolor($newwidth, $newheight); $white = imagecolorallocate($output, 255, 255, 255); $black = imagecolorallocate($output, 0, 0, 0); imagefill($output, 0, 0, $black); imagefill($white_space, 0, 0, $white); //Put border by filling with white box except for border imagecopy($output, $white_space, $bordersize, $bordersize, 0, 0, $wwidth, $wheight); //overlay png image of qr code imagecopy($output, $im, ($newwidth - $width) / 2, 5, 0, 0, $width, $height); //output image with qr code imagepng($output, $filename); //add text to image $image = new \NMC\ImageWithText\Image($filename); $text = new \NMC\ImageWithText\Text($string, 1, $maxchars); $text->font = $fontfile; $text->align = 'left'; $text->size = $fontsize; $text->startY = (int) ($newheight * (215 / 300)); //below qr code. Adjusted for dif image sizes $text->startX = (int) (($newwidth - $text_width) / 2); //center $image->addText($text); $image->render($filename); //clean up imagedestroy($output); imagedestroy($im); }
function draw($kode_proc = 0, $id_barang = 0, $kd_inventaris = 0, $id_distribusi = 0) { $tabel = substr($id_barang, 0, 2); if ($tabel == "01") { $tabel = "inv_inventaris_barang_a"; } else { if ($tabel == "02") { $tabel = "inv_inventaris_barang_b"; } else { if ($tabel == "03") { $tabel = "inv_inventaris_barang_c"; } else { if ($tabel == "04") { $tabel = "inv_inventaris_barang_d"; } else { if ($tabel == "05") { $tabel = "inv_inventaris_barang_e"; } else { if ($tabel == "06") { $tabel = "inv_inventaris_barang_f"; } } } } } } $data = $this->inv_barang_model->get_data_barang_edit_table_all($kode_proc, $id_barang, $kd_inventaris, $tabel, $id_distribusi); $s = array(); $s[0] = substr($data['barang_kembar_proc'], 0, 2); $s[1] = substr($data['barang_kembar_proc'], 2, 2); $s[2] = substr($data['barang_kembar_proc'], 4, 2); $s[3] = substr($data['barang_kembar_proc'], 6, 2); $s[4] = substr($data['barang_kembar_proc'], 8, 2); $s[5] = substr($data['barang_kembar_proc'], 10, 2); $s[6] = substr($data['barang_kembar_proc'], 12, 2); $s[7] = substr($data['barang_kembar_proc'], 14, 2); $s[8] = substr($data['barang_kembar_proc'], 16, 2); $s[9] = substr($data['barang_kembar_proc'], 18, 2); $s[10] = substr($data['barang_kembar_proc'], 20, 2); $s[11] = substr($data['barang_kembar_proc'], 22, 2); $s[12] = substr($data['barang_kembar_proc'], 24, 2); $s[14] = substr($data['barang_kembar_proc'], 26, 2); $kode_proc = implode(".", $s); $data = array("Nama:" . $data['nama_barang'], "Kode: " . $kode_proc . "." . $data['id_inventaris_barang'], "Harga:" . "Rp." . number_format($data['harga'], 2), "Pembelian:" . date("d-m-Y", strtotime($data['tanggal_pembelian'])), "Jumlah:" . $data['jumlah']); $PNG_TEMP_DIR = APPPATH . '../public/temp/'; //html PNG location prefix $PNG_WEB_DIR = base_url() . 'public/temp/'; if (!file_exists($PNG_TEMP_DIR)) { mkdir($PNG_TEMP_DIR); } $filename = $PNG_TEMP_DIR . $id_barang . '.png'; $errorCorrectionLevel = 'L'; $matrixPointSize = 3; $text = implode("\n", $data); QRcode::png($text, $filename, $errorCorrectionLevel, $matrixPointSize, 2); header('Content-Type: image/png'); readfile($PNG_WEB_DIR . basename($filename)); //echo $kode_proc; }
/** * Genera la imagen del código QR a partir de los datos que se reciben por parámetro. * @author dmdiazf * @since 22/10/2015 */ public function generateQRImage($code) { ob_start("callback"); $this->link = $this->link . "/" . $code; $debugLog = ob_get_contents(); ob_end_clean(); QRcode::png($this->link); }
public function get() { $this->load(); if (!is_file($this->file)) { QRcode::png($this->url, $this->file, $this->error_correction, $this->size, 2); } return '<img src="' . $this->image . '" />'; }
public static function create($data, $filepath) { // 纠错级别:L、M、Q、H $errorCorrectionLevel = 'L'; // 点的大小:1到10 $matrixPointSize = 8; QRcode::png($data, $filepath, $errorCorrectionLevel, $matrixPointSize, 2); }
function gen_qrcode($url, $outFile) { if (!file_exists($outFile)) { // Generate the QR code QRcode::png($url, $outFile); } return $key; }
public function qrcode() { $url = I('get.data'); Vendor('phpQrcode.phpqrcode'); $errorCorrectionLevel = "L"; $matrixPointSize = "4"; \QRcode::png($url, false, $errorCorrectionLevel, $matrixPointSize); }
function insert($room) { $dao = new RoomDao(); $nextId = $dao->nextId(); $room->qrcode = 'upload/qrcode/' . uniqid() . '.png'; QRcode::png(BASE_URL . '/room/' . $nextId, $room->qrcode); $dao->insert($room); }
public function store_codeOp() { if ($_GET['text']) { $text = $_GET['text']; $size = '6'; $level = 'H'; $logo = BASE_RESOURCE_PATH . DS . '/logo_2.png'; $padding = '2'; $path = BASE_RESOURCE_PATH . DS . 'phpqrcode'; $QR = $path . 'qrcode.png'; require_once BASE_RESOURCE_PATH . DS . 'phpqrcode' . DS . 'phpqrcode.php'; QRcode::png($text, $QR, $level, $size, $padding); if ($logo !== false) { $QR = imagecreatefromstring(file_get_contents($QR)); $logo = imagecreatefromstring(file_get_contents($logo)); $QR_width = imagesx($QR); $QR_height = imagesy($QR); $logo_width = imagesx($logo); $logo_height = imagesy($logo); $logo_qr_width = $QR_width / 5; $scale = $logo_width / $logo_qr_width; $logo_qr_height = $logo_height / $scale; $from_width = ($QR_width - $logo_qr_width) / 2; imagecopyresampled($QR, $logo, $from_width, $from_width, 0, 0, $logo_qr_width, $logo_qr_height, $logo_width, $logo_height); } header("Content-Type:image/jpg"); imagepng($QR); } else { output_error('参数错误00023'); } }
function generation($name, $sortName, $orgName, $email, $qrpng) { //initialize unused variables $phone = ''; $phonePrivate = ''; $phoneCell = ''; $addressLabel = ''; $addressPobox = ''; $addressExt = ''; $addressStreet = ''; $addressTown = ''; $addressRegion = ''; $addressPostCode = ''; $addressCountry = ''; // we building raw data $codeContents = 'BEGIN:VCARD' . "\n"; $codeContents .= 'VERSION:2.1' . "\n"; $codeContents .= 'N:' . $sortName . "\n"; $codeContents .= 'FN:' . $name . "\n"; $codeContents .= 'ORG:' . $orgName . "\n"; $codeContents .= 'TEL;WORK;VOICE:' . $phone . "\n"; $codeContents .= 'TEL;HOME;VOICE:' . $phonePrivate . "\n"; $codeContents .= 'TEL;TYPE=cell:' . $phoneCell . "\n"; $codeContents .= 'ADR;TYPE=work;' . 'LABEL="' . $addressLabel . '":' . $addressPobox . ';' . $addressExt . ';' . $addressStreet . ';' . $addressTown . ';' . $addressPostCode . ';' . $addressCountry . "\n"; $codeContents .= 'EMAIL:' . $email . "\n"; $codeContents .= 'END:VCARD'; // generating QRcode::png($codeContents, $qrpng, QR_ECLEVEL_L, 3); $gen_code = 1; }