Tutorials

Article Content:How to generate QR code with codeigniter

How to generate QR code with codeigniter

How to generate QR code with codeigniter .

Many days ago and I came back again with new task and new tutorial, this tutorial about

 Qr code... So before see the video lets know what QRcode is and how to use it?

 

What is a QR code?

A QR code is a shortcut of Quick Response code it is a type of barcode, it is the updated version of the barcode, and it is a (2D) barcode that can store about 4,000 alphanumeric characters in a just small image.

It was developed to serve auto manufacturing industry but today it has a number of purposes in many cases like  (marketing, transportation, entertainment .etc.)

Why was it most popular?

Because it was very easy to use, just go to iPhone store or play store or any mobile application store, download Qr reader application and scan with your mobile camera.

You don’t need to use barcode scanner, it is also can take actions not just copy data from QR code, as example you can redirect someone to your Facebook page or your YouTube channel or to send SMS or to make Skype call, Whatsapp use QR code to encrypt users data and to complete authentication login process.

NotePHP QR Code is Open Source (LGPL) library for generating QR Code if you want to read the full documentation for more details you can read it from here

 

Installation:

 

 

1- Download the project from the bottom link page and extract it in localhost

2- Create new database, name it as (demo)

3- Import tables from application/tables

4- Go to the URL  http://localhost/codeigniter_demo/Qr_code_generate

 

 

Project structure:

In this app we have

 

1- Qr_code_generate controller

In this controller, we have two methods Index to show random user from users table and print_qr to generate Qr image files from users table

2- User_model model

To select our users from users table

3- Ci_qr_code library

Import qr_code original files from third party folder

4- QR code third_party

The original files for PHP QR code library, you can also download this package from their Sourceforge repo in this link, but I recommended to use it from my full example directly

5- Global folder

Contains assets file like bootstrap 3 main framework and starter theme with JavaScript , HTML ,  CSS  files

6- Views folder

Which contains views file for our layout templates with header and footer and content

 

                          TRY Demo   Download

You can show this video to show how it is works



  • Gilang
    Help I got error how to fix it? Severity: Warning Message: imagepng(C:\xampp\htdocs\PROJECT\FixedAsset/Assets/tmp/qr_codes/PC-000002 .png): failed to open stream: Invalid argument Filename: qrcode/qrimage.php Line Number: 46 Backtrace:
    August 8, 2017
    Reply
  • Muhamamd Jahangir
    Thank you so much for providing us such grreat thing in very simple words. I tried your code, it works perfectly. As I click on Pritn QR Code buttton, it give me QR image, how we can generate qr code and save it in folder(codeingiter/qr-images/) without clicking any button. Actually I want to generate QR code by calling a controller method. Any help will be appreciated. Thanks in advance
    January 23, 2018
    Reply
  • admin
    you are welcome muhamad just call it from your function and put it at the end of the function like this http://sandbox.onlinephpfunctions.com/code/823f1e56d149d2d182c9a0a471e62d2bee505d37 then go to print_qr function and remove all code under this comment // then redirect to see image link
    January 23, 2018
    Reply
  • prakalp varshney
    A blank image is downloaded after i integrate this into my project..... can any one suggest what can i do????
    June 11, 2018
    Reply
    • admin
      info@webeasystep.com
      try to check the PHP version against the library version form their repository
      June 13, 2018
      Reply
      • Prakalp varshney
        prakalpvarshney2@gmail.com
        Thanks , it's working perfectly after removing all code under comment // then redirect to see image link... qr code is generated and i used to show it by
        June 13, 2018
        Reply
  • gautam
    Please provide DB structure with demo entries
    September 25, 2018
    Reply
  • Suresh
    Thanks for providing such a grate good. how to add redirection url for QR code. please help
    June 4, 2020
    Reply
  • Dimitri
    i interested about the code
    July 29, 2020
    Reply

Leave a Reply

Your email address will not be published.


Notify me of followup comments via e-mail.
You can also Subscribe without commenting.