function show_qr($size = 128) { global $post; $permalink = get_permalink($post->ID); $qr = new qrcode(); $qr->link($permalink); echo '<a href="', $permalink, '" class="qr-anchor"><img src="', $qr->get_link(intval($size)), '" class="qr-img" title="', $post->post_title, '"/></a>'; }
<?php if (isset($_POST['type'])) { //here we got all data from submitted form //we include class file include "qrcode.php"; //create an instance $qr = new qrcode(); //then we check what type of information user wanted to create qr code //to know what are possible types and what information needs to inserted, check the example file switch ($_POST['type']) { case "url": //then we use submitted information here, word inside $_POST[] brackets must match value of name attribute in the input field //<p>http://<input type='text' name='url' $qr->link($_POST['url']); break; case "txt": $qr->text($_POST['txt']); break; case "sms": $qr->sms($_POST['sms_phone'], $_POST["sms_text"]); break; case "bookmark": $qr->bookmark($_POST['mms_phone'], $_POST["mms_text"]); break; case "tel": $qr->phone_number($_POST['tel']); break; case "contactinfo": $qr->contact_info($_POST["contact_name"], $_POST["contact_address"], $_POST["contact_phone"], $_POST["contact_email"]); break;
* Fee free to distribute and modify code, but keep reference to its creator * * This class generate QR [Quick Response] codes with proper metadata for mobile phones * using google chart api http://chart.apis.google.com * Here are sources with free QR code reading software for mobile phones: * http://reader.kaywa.com/ * http://www.quickmark.com.tw/En/basic/download.asp * http://code.google.com/p/zxing/ * * For more information, examples and online documentation visit: * http://webcodingeasy.com/PHP-classes/QR-code-generator-class **************************************************************/ include "qrcode.php"; $qr = new qrcode(); //link $qr->link("http://code-snippets.co.cc"); echo "<p>Link</p>"; echo "<p><img src='" . $qr->get_link() . "' border='0'/></p>"; //bookmark $qr->bookmark("WebcodingEasy.com", "http://webcodingeasy.com"); echo "<p>Bookmark</p>"; echo "<p><img src='" . $qr->get_link() . "' border='0'/></p>"; //text $qr->text("Any UTF8 characters like �ēū"); echo "<p>UTF8 text</p>"; echo "<p><img src='" . $qr->get_link() . "' border='0'/></p>"; //sms //First parameter - phone number //Second parameter - sms text $qr->sms("12345678", "sms text"); echo "<p>SMS with phone number and text</p>";
<?php /************************************************************* * This script is developed by Arturs Sosins aka ar2rsawseen, http://webcodingeasy.com * Fee free to distribute and modify code, but keep reference to its creator * * This class generate QR [Quick Response] codes with proper metadata for mobile phones * using google chart api http://chart.apis.google.com * Here are sources with free QR code reading software for mobile phones: * http://reader.kaywa.com/ * http://www.quickmark.com.tw/En/basic/download.asp * http://code.google.com/p/zxing/ * * For more information, examples and online documentation visit: * http://webcodingeasy.com/PHP-classes/QR-code-generator-class **************************************************************/ include "qrcode.php"; $qr = new qrcode(); //link $qr->link("10-09-20"); echo "<p>Link</p>"; echo "<p><img src='" . $qr->get_link() . "' border='0'/></p>";
public function generarHtmlCertificado($imprimir, $codigoGenerado, $tituloCurso, $duracionEdicion, $fechaEdicion, $nombreFacilitador) { //Instanciando Librería para hacer el codigo QR. $GBD = new baseDatosGestor(); $miFondo = 'background: url("recursos/certificados/' . $this->_fondo . '") no-repeat'; $valorLogoExtra = $this->dameLogoExtra(); $qr = '<div id="qr"></div>'; if ($valorLogoExtra != 'ninguno') { $miLogoExtra = '<div class="logo"><img src="recursos/certificados/' . $this->_logoExtra . '"></img></div>'; } else { $miLogoExtra = ''; } $firmasExtras = $this->dameFirmasExtras(); if (empty($firmasExtras)) { $numeroDeFrimas = 1; } else { $numeroDeFrimas = count(explode('(#=P=#)', $firmasExtras)) + 1; } $tamanoTdFirma = 1000 / $numeroDeFrimas; $tamanoTdFirma = floor($tamanoTdFirma); $colFirmantes = explode('(#=P=#)', $firmasExtras); $tdFirmantes = ''; $tdFirmantesCargos = ''; $firmaFacilitador = $this->dameFirmaFacilitador(); list($calificativoFacilitador, $cargoFacilitador) = explode('(#=D=#)', $firmaFacilitador); $tdFirmantes .= '<td class="firmante">' . $calificativoFacilitador . ' ' . $nombreFacilitador . '</td>'; $tdFirmantesCargos .= '<td class="firmante">' . $cargoFacilitador . '</td>'; foreach ($colFirmantes as $firma) { list($calificativo, $nombre, $cargo) = explode('(#=D=#)', $firma); $tdFirmantes .= '<td class="firmante">' . $calificativo . ' ' . $nombre . '</td>'; $tdFirmantesCargos .= '<td class="firmante">' . $cargo . '</td>'; } foreach ($imprimir as $persona) { $nombre = $persona['nombre']; $documento = $persona['documento']; $tipo = $persona['tipo']; $idPersona = $persona['id']; if ($tipo == 'facilitador') { $datoTipo = 'COMO FACILITADOR'; } else { if ($tipo == 'participacion') { $datoTipo = 'POR SU PARTICIPACIÓN'; } elseif ($tipo > 59) { $datoTipo = 'POR APROBACIÓN'; } elseif ($tipo < 60 and $tipo > 0) { $datoTipo = 'POR PARTICIPACIÓN'; } elseif ($tipo == 0) { //NADA } else { exit("ERROR: NINGUN TIPO DE CERTIFICADO COINCIDE"); } } if ($tipo != 0 or $tipo == 'facilitador' or $tipo == 'participacion') { //link $explode = $GBD->dameURL(); $enlace = explode("?", $explode); $linkk = $enlace[0] . "verificacionCod.php?id=" . $codigoGenerado . "-" . $idPersona; qrcode::link($linkk); $link = qrcode::get_link(); $cuerpoRepetitivo .= '<div class="cuerpoCompleto"> <table class="cabesera"> <tr> <td class="lado" align="center"> <div class="logo"> <img src="recursos/logoUPTA.jpeg"></img> </div> </td> <td class="centro"> <p style="font-size: 20px; margin: 0px;" > REPÚBLICA BOLIVARIANA DE VENEZUELA<br/> MINISTERIO DEL PODER POPULAR PARA LA EDUCACIÓN UNIVERSITARIA<br/> UNIVERSIDAD POLITÉCNICA TERRITORIAL DEL ESTADO ARAGUA "FEDERICO BRITO FIGUEROA" <br/> </td> <td class="lado" align="center"> ' . $miLogoExtra . '</td> </tr> <tr> <td class="lado"> </td> <td class="centro" style="font-size: 22px;"> <br/><br/> <div class="tituloCurso"> OTORGA EL PRESENTE CERTIFICADO<br/> ' . $datoTipo . ' A: <br/><br/> <p style="font-size: 36px; margin: 0px;" >' . $nombre . ' </p> <p style="font-size: 32px; margin: 0px;" >' . $documento . '</p><br/> <p style="font-size: 32px; margin: 0px;">' . $tituloCurso . '</p> </div><br/> <p style="font-size: 20px; margin: 0px;">Venezuela - Estado Aragua<br/> DURACIÓN: ' . $duracionEdicion . '<br/> ' . $fechaEdicion . '</p> </td> <td class="lado"> </td> </tr> </table> <table class="firmas" style="font-size: 22px;"> <tr> ' . $tdFirmantes . ' </tr> <tr> ' . $tdFirmantesCargos . ' </tr> </table> <div class="codigoQR"> <img src=' . $link . ' border="0"/> </div> <table class="codigoGenerado"><tr><td><p style="font-size: 20px; margin: 0px;">Código Verificación: ' . $codigoGenerado . '-' . $idPersona . '</p></td></tr></table> </div>'; } } $htmlPDF = ' <html> <head> <script type="text/javascript" src="media/js/jquery/qrcode.js"></script> <style type="text/css"> body * { overflow: hidden; font-family: kartika; font-weight: bold; } @page { margin: 0px; } body { margin: 0px; ' . $miFondo . ' } div.cuerpoCompleto { margin: 0px; width: 1000px; height: 700px; } table { width: 1000px; padding: 50px; } div.tituloCurso { font-size: 16; } table.cabesera { position:absolute; left:0px; top:0px; } table.firmas { position:absolute; left:0px; top:600px; } div.logo { width: 150px; height: 120px; } table td.lado { padding-top:30px; width: 150px; height: 120px; } table td.centro { width: 700px; height: 100px; text-align: center; } table td.firmante { width: ' . $tamanoTdFirma . 'px; text-align: center; vertical-align: text-top; } table.codigoGenerado { position: absolute; top: 700px; left: 0px; width: 1100px; } div.codigoQR img{ position: absolute; top: 680px; float: right; right: 40%; } table.codigoGenerado td { text-align: center; } </style> </head> <body onload="update_qrcode()"> ' . $html1 . $cuerpoRepetitivo . ' </body> </html>'; return $htmlPDF; }