Kemblali lagi bersama adi-techno, Ohh iya sebelum lanjut, Bagaimana kabarnya hari ini, yah semoga kita selalu dalam keadaan yang sehat, yang kuat, yang semangat yah. Ok kali ini kita akan belajar bagaimana membuat Barcode dan QRcode pada PHP Codeigniter 3. mudah sekali gan anda tinggal ikuti langkah-langkah tutorial dibawah ini dan simple saja anda hanya kopi kode-kode script dibawah. Semoga berhasil yah.. Good Luck
Donwload master Barocde link google drive :
Download Master QRcode
Donwload master QRcode link google drive : Download Master Barcode
Langkah 1. Silahkan anda download Library Barcode dan QRcode nya dan silahkan anda ekstrak file nya dan kopi hasil ekstraknya di folder
ini untuk QRcode :
ini untuk Barcode :
Donwload master QRcode link google drive : Download Master Barcode
Langkah 1. Silahkan anda download Library Barcode dan QRcode nya dan silahkan anda ekstrak file nya dan kopi hasil ekstraknya di folder
libraries
jika sudah selesai maka struktur foldernya akan seperti berikut :ini untuk QRcode :
libraries/qrcode/Ciqrcode.php
ini untuk Barcode :
libraries/Zend/Zend.php
Langkah 2. Selanjutnya anda buat sebuah file Controller dengan nama file
Render.php
dan kopi code controller di bawah ini :
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Render extends CI_Controller {
public function __construct()
{
parent::__construct();
$this->load->library('Ciqrcode');
$this->load->library('Zend');
$this->load->database();
}
public function index()
{
$data['title'] = "Belajar Membuat QRcode dan Barcode di PHP CodeIgniter 3";
$data['data'] = $this->db->get('tb_mahasiswa')->result();
// echo "<pre>";
// print_r($data['data']);
// exit();
// echo "</pre>";
$this->load->view('render', $data);
}
public function QRcode($kodenya)
{
//render qr code dengan format gambar PNG
QRcode::png(
$kodenya,
$outfile = false,
$level = QR_ECLEVEL_H,
$size = 6,
$margin = 2
);
}
public function Barcode($kodenya)
{
$this->zend->load('Zend/Barcode');
Zend_Barcode::render('code128', 'image', array('text' => $kodenya));
}
}
/* End of file Render.php */
/* Location: ./application/controllers/Render.php */
Langkah 3. Anda buat file view dengan nama file
render.php
selanjutnya simple saja anda tinggal kopi kode view berikut :
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title><?php echo $title ?></title>
<link rel="stylesheet" href="">
<style>
body{
text-align: center;
}
</style>
</head>
<body>
<h1 align="center"><?php echo $title ?></h1>
<?php $kode = "1234567889347294734"; ?>
<h3>Ini render QRcode</h3>
<img src="<?php echo site_url('Render/QRcode/'.$kode); ?>" alt="">
<p><h3>Ini render Barcode</h3></p>
<img src="<?php echo site_url('Render/Barcode/'.$kode); ?>" alt="">
<br>
<!-- <table style="width: 100%; border-collapse: collapse;" border="1">
<tr>
<th>No</th>
<th>NIM</th>
<th>QRcode</th>
<th>Barcode</th>
</tr>
<?php $no=1; foreach ($data as $row): ?>
<tr>
<td><?php echo $no++; ?></td>
<td><?php echo $row->nim ?></td>
<td>
<img src="<?php echo site_url('Render/QRcode/'.$row->nim); ?>" alt="">
</td>
<td>
<img src="<?php echo site_url('Render/Barcode/'.$row->nim); ?>" alt="">
</td>
</tr>
<?php endforeach ?>
</table> -->
</body>
</html>
hallo pak
ReplyDeletesaya mau download master code dan qrcode, ketika mau saya download malah jadi download ke dompdf.
Ohh iya gan, saya minta maaf salah link, nanti saya update. Terima kasih.
ReplyDeletelink library download qrcode dan barccode sudah saya perbarui silahkan di download
ReplyDeleteHello friend, barcode still works? It's showing me just a white dot on the screen ...
ReplyDeletethank u very much for your help bro but i still need some help here because i need to store this QRcode in a file.pdf.
ReplyDeletecan u help me please.
This comment has been removed by the author.
ReplyDelete