Personal License $4.99

1 site, unlimited servers No source distribution Commercial use allowed Can modify source Read full license | More Info

Developer License $29.99

Unlimited projects Source and binary distribution Commercial use allowed Can modify source 1 year support Attribution required Read full license | More Info

You need to log-in or create an account
  • Create an account
  • Log-in
  • Please use your real name.
  • Account activation link will be sent to this address.
  • Minimum 8 characters

Clicking this button confirms you read and agreed to the terms of use and privacy policy.

Starting from $ 4.99

View Pricing 14 days money-back guarantee
(1 ratings)

PHP QRcode Generator

QR Code image generator using Google Charts API. Generate QR images with custom properties and save, embed and download it on the fly.

Share and win up to $15k in prizes each month!Learn more

Share

Description

A QR code image generator class. Generate QR codes and use them in a variety of ways:

  • Save for later use
  • Embed directly in an HTML page (as an image or a base64 string)
  • Download generated image to your local computer.
  • Apply a watermark to your qrcode image
  • Generate your personal qr code image with a vCard Generator
Back to top

Documentation

gQRcode is a QR code rendering class that uses the Google Charts API.

How to use this class

Include the class in your script and use setter methods to define QR code attributes. The class uses dynamic setters via the magic __call() function so you can set any custom attributes you want.

Example - generating a QR code image with contact information:

// Include the library
require('gQRcode.php');
// Instance of the QR code class
$gQRcode = new gQRcode();
// Add the contact information using setters
$gQRcode->name("Name Example")
        ->company("NameCompany")
        ->phone("123456")
        ->email("test@noreplay.com")
        ->address("bla blabla")
        ->AllThatYouWant("Hello World");
// and embed the QR code in the page as a simple HTML img
echo $gQRcode->embed();

Class methods

Function: The first two function are very simple: embed() that you can see above, and embed64() that work as embed(), but return a base64 encoded string that you can embed in HTML instead of a regular image. For more info see: http://en.wikipedia.org/wiki/Data_URI_scheme

This function return the URL to the QR code image.

public function getLink( $size = 150 )

  1. @param int $size optional, size of you image

This function saves the QR code image generated.

public function saveImage( $name, $size = 150 )

  1. @param string $name name of your image
  2. @param int $size optional, size of you image

Download the generated image (opens download dialog)

public function downloadImage( $name )

  1. @param string $name name of your image

Apply a watermark to an image

public function applyWatermark( $name_image, $name_watermark, $name_newImg, $with = 30, $height = 30)

  1. @param Name of your qrcode image from floder cache/
  2. @param Name of your watermark from floder logo/
  3. @param Name of your image with watermark, saved in cache/
  4. @param With of your logo for watermark
  5. @param Height of your logo for watermark

Example:

<?php
require('gQRcode.php');

$gQRcode = new gQRcode();

$gQRcode->text("Hello world!")
        ->phone("1234567")
        ->email("test@noreplay.com");

$gQRcode->saveImage("qrcodeimg.png", 250);

$gQRcode->applyWatermark( "qrcodeimg.png", "html5.png", "imgwithwatermark.png", 40, 40 )
        ->embedfCache("imgwithwatermark.png");

Embed a image from your cache floder

public function embedfCache( $name )

  1. @param name of image cached
Read all 9 comments »

Questions & Comments

Leave a comment

You must be logged-in to leave a comment.
Log-in now or register for a free account.
You must be logged-in to vote. Log-in to your account or register now.
View all 1 reviews »

User Reviews

    This is exactly what I was looking for and exactly what I needed. Although I rated the documentation as a 3-star it was because of my lack of familiarity with some of the php constructs. I did have the function up and running exactly as I wanted in less than 5 minutes.
    - Gerry Williams, 5 months ago
    Flag review
    Was this helpful? Yes No

Starting from $ 4.99

View Pricing 14 days money-back guarantee