Giter VIP home page Giter VIP logo

phpqrcode's Introduction

## DEPRECATED ##

Please do not use this QR code library anymore, This library has not been maintained for a long time and should be considered insecure, 
It does not use any of the features of modern PHP versions (7+) and would need a lot of work in order to get modernized.

Please instead take a look at https://github.com/chillerlan/php-qrcode

Thanks

This is PHP implementation of QR Code 2-D barcode generator. It is pure-php
LGPL-licensed implementation based on C libqrencode by Kentaro Fukuchi.

== UPDATE ==
Added support for eps export
Usage : QRcode::eps('arguments');

Added support for SVG export
Usage : QRcode::svg('arguments');

Added support for color export :
example : 
$back_color = 0xFFFF00;
$fore_color = 0xFF00FF;
QRcode::png('some othertext 1234', false, 'h', 20, 1, false, $back_color, $fore_color);


Copyright (C) 2012 by Alexandre Assouad 

== LICENSING ==

Copyright (C) 2010 by Dominik Dzienia 

This library is free software; you can redistribute it and/or modify it under
the terms of the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU Lesser General Public License (LICENSE file)
for more details.

You should have received a copy of the GNU Lesser General Public License along
with this library; if not, write to the Free Software Foundation, Inc., 51
Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

== INSTALATION AND USAGE ==

 * INSTALL file
 * http://sourceforge.net/apps/mediawiki/phpqrcode/index.php?title=Main_Page

== CONTACT ==

Fell free to contact me via e-mail (deltalab at poczta dot fm) or using
folowing project pages:

 * http://sourceforge.net/projects/phpqrcode/
 * http://phpqrcode.sourceforge.net/
  
== ACKNOWLEDGMENTS ==

Based on C libqrencode library (ver. 3.1.1) 
Copyright (C) 2006-2010 by Kentaro Fukuchi
http://megaui.net/fukuchi/works/qrencode/index.en.html

QR Code is registered trademarks of DENSO WAVE INCORPORATED in JAPAN and other
countries.

Reed-Solomon code encoder is written by Phil Karn, KA9Q.
Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q
 

phpqrcode's People

Contributors

benaryorg avatar dashmug avatar matslindh avatar neok avatar pcr-coding avatar pstast avatar steinsag avatar t0k4rt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

phpqrcode's Issues

A strange problem arises when high concurrency generates QR Code

this is my problem detail ,can somebody help?
In the PHP error_log,Intermittent occurrence of warning,like this :
1.imagecreatefromstring(): gd-png: fatal libpng error: [00][00][00][00]: invalid chunk type
2.imagecreatefromstring(): gd-png: fatal libpng error: Read Error: truncated data
3.imagecreatefromstring(): gd-png: fatal libpng error: PLTE: CRC error
4.imagecreatefromstring(): gd warning: one parameter to a memory allocation multiplication is negative or zero
5.imagecreatefromstring(): gd-png: fatal libpng error: IHDR: CRC error

1.Server environment(centos7.2+php7.1 + nginx+gd2.1.0+libpng1.5.13+zlib1.2.7)
2.QPS is somewhere around 100 to 500
3.code like this:
QRcode::png($url, $file_path, $errorCorrectionLevel, $matrixPointSize, $margin);
$QR = imagecreatefromstring(file_get_contents($file_path));

I wonder if the file_put_content need a lock in phpqrcode project ?
This problem has been bothering me for a few days,Jesus,I'm crazy..... help

EPS CMYK

Hi!

First, thank you for the nice library!

I found a issue in the code. Lines 63 and 70 in /qrvect.php should be
63: $c = round((($fore_color & 0xFF000000) >> 24) / 255, 5);
70: $c = round((($back_color & 0xFF000000) >> 24) / 255, 5);
instead of
63: $c = round((($fore_color & 0xFF000000) >> 16) / 255, 5);
70: $c = round((($back_color & 0xFF000000) >> 16) / 255, 5);

cause of a wrong calculation for cyan-color.

Thank you!

Best regards
Max

EPS Export not working

Calling QRcode::eps results in:

Fatal error: Call to undefined method QRcode::eps()

This is when using the combined phpqrcode.php file

Resize svg

Hi !
I need to display a page with 3 QR Codes : one big, one medium and one small.

After checking the doc, I found this :

$dataText   = 'PHP QR Code :)'; 
    $svgTagId   = 'id-of-svg'; 
    $saveToFile = false; 
    $imageWidth = 250; // px 

    // SVG file format support 
    $svgCode = QRcode::svg($dataText, $svgTagId, $saveToFile, QR_ECLEVEL_L, $imageWidth); 

    echo $svgCode;

But it doesn't work, nothing is displayed...

Can somebody help me ?

Thanks,

why phpqrcode so slow?

It take 4s or more when I created qrcode with this lib.
here is my code:
include "phpqrcode/qrlib.php"; $text = "http://localhost:8080/Home/Index/index/some_code_value/123456.html"; \QRcode::png($text,false,'H',5,1);
Someone can tell me why?

Transparent background

Hello, very neat plugin. Is there a way to get the background transparent instead of setting a color?

Duplicate output implementation in qrvact.php

Hello there,

in qrvact.php on line 171:
$output = ...;
and in line 177 new implementation:
$output = ...;

Needless double implemantation i guess.

And in line 183:
!empty($back_color) is false when $back_color = 0x000000, so no background is set when we want a black one.

Wrong encoding of UTF-8 (Russian) text

Encoded Russian text is cropped. For example, original text is
Русский текст
Decoded QR value is
Русски
It's quite similar to wrong detection of the original string length (in bytes, not in chars). QR scanning application works correct (checked)! The default page (index.php) used.

screenshot_2017-10-10-20-24-04

screenshot_2017-10-10-20-24-04-cr

test628e5dd4798def82e7afdfd116dbc84e

Qr code With Random Number

I want To Generate Qr Code with Random Number when i click the generate Qrcode.
And ThaRcode should be unique Every time.

Text box area?

QCode
Not knowing a whole lot of php etc...

Have you been able to get or know a way to get your code to use a text box?
For the most part I have it working with the problem I'm having is that the carriage returns are showing up on the text displayed in the phone QRCode reader.

Row1[]
Row2[]

I'm trying to paste the few lines that I changed but github is not allowing me to do so.
I attached a Qcode of what I did. You can see [] on one of the lines.

Thanks for your time to read my message.
Bob

SVG Fill Color Not Correctly Padded

When qrvect.php generates the code for the svg image it uses the php method "dechex" which does not automatically pad the resulting hex color number with zeros, hence the color black is encoded as a simple "#0" rather than the correct "#000000". I'm not sure about other browsers, but google chrome does not automatically expand this. The result is an svg QRcode image that is not visible against a white background.

I made simple fix by surrounding the call to dechex with php's built in str_pad function.

Does anyone else have a better idea to fix this?

eps() and svg() behaves differently from png()

The eps() method and the svg() function both return the content generated, instead of outputting it (which png() does), even though the documentation says otherwise. The methods also set the headers for the content they're outputting, so it seems it wasn't meant to just return the data.

I have a patch that changes this, but as there is a BC concern I'd like to discuss whether we actually want to do that. The patch changes the return to a print / echo, which brings behavior in line with png(), but will break applications that retrieves the content and then stores it somewhere else instead. We might handle that by introducing a second method (I'd prefer to implement the different behaviors as different methods anyway, really) that replicates the old functionality, or introduce the "correct" behavior as a new method - this will require updating the documentation and might be confusing later.

For vectors:
https://github.com/t0k4rt/phpqrcode/blob/master/qrvect.php#L37

For images:
https://github.com/t0k4rt/phpqrcode/blob/master/qrimage.php#L36

Make mask finding configurable (random vs static)

I'd like to use your library without changing code.
But if I want to generate the same qr code images for the same text as input I have to change the constant QR_FIND_FROM_RANDOM. In my opinion the better solution would be to make it settable, may be by a method like QRmask::setMaskFindingMode() or so.
This would offer the possibility to generate the same qr code images without changing the code everytime you want to change the finding mask mode.

Project status

As title, I find this project via GitHub repository search.

It looks good, but it seems this project has been inactive for whiles.

I wonder this project is still maintained?

phpqrcode on sourceforge

Hi, is this code (phpqrcode) more up-to-date than on sourceforge?

I'm have two issues with this code from sourceforge:

  1. displays broken image

  2. cannot modify header information:

I have checked for extra white space before and after starting and ending php file tags.

Any help would be really appreciated!

Thanks,

Kevin

Including string in final QR code EPS

Trying to export the QR code in EPS format with the encoded string in plain text directly below it, to make a label of sorts.

Been meddling around with the code to try and understand the process and see where I can inject this step but I'm not getting far.

Is this even possible or am I asking too much?

qrcode with logo

Hi,
Is it possible to add logo on generated Qrcode?, I real need this please/.

cannot output numeric qrcode

The parsing of numeric values inside qrsplit.php leads to an excepption.
The function that parse the value as numeric is broke in in PHP >= 7.
Is there a reason why "ord()" is used instead of "is_numeric()" or perhaps a preg_match() ?
I can help to fix if you tell me what I can do and what don't.
Thanks.

Image is broken when added into PDF with DOM library

Hi,

I am adding a qr code image to a pdf using DOM:

QRcode::png($qr_code, "qrcodereplace.png", "L", 4, 4); ... $dompdf = new DOMPDF();
Using external libraries from quickchart.io or chart.googleapis.com (quickchart) qr images was displayed correctly.
But using self generated image png, then image was saved to own server correctly (qrcodereplace),
but after inserting it into PDF it is broken (brokenqr)

I did image analysis of the png images with https://compress-or-die.com/analyze-process
And all not working images have: ColorType Palette
Each working ones have only difference here: ColorType RGB

Is there any way of changing ColorType of generated PNG or do you know any other issue that is causing this behaviour?

Thank you very much for your help.

Best regards,

Thomas

Cannot modify header information - headers already sent by

Hello
I insert QR code into my html which I render via phpwkhtlto pdf
The PDF is not rendered and browser just show me QR code and on the page is a few errors.

<b>Warning</b>:  Cannot modify header information - headers already sent by (output started at /mnt/databox/www/myweb/pdf/phpqrcode-master/qrvect.php:147) in <b>/mnt/databox/www/myweb/pdf/wkhtmltopdf/mikehaertl/php-tmpfile/src/File.php</b> on line <b>64</b><br />
<br />

page from where it is started:

  <?php
    ini_set("memory_limit", "128M");
    ini_set('display_errors', '1');
    error_reporting(E_ALL);

    require __DIR__ . '/wkhtmltopdf/autoload.php';
    require_once ('phpqrcode-master/qrlib.php');
    use mikehaertl\wkhtmlto\Pdf;

$svg_QR_Code = QRcode::svg('PHP QR Code :)');


    $pdf = new Pdf;
    $pdf->addPage('

    <html>
    <head>
    </head>
     <body>
     <div id="qr-picture">' .$svg_QR_Code. '  </div>
    </body>
    </html>
');

thank You for any help

Cannot set colour via $_GET param

I have used the lib to create a parameterised PHP page that we can generate QR codes from the params in the url:

include( '/qrlib/qrlib.php' );

if (isset($_GET['fg'])&&!empty($_GET['fg'])) {
    $fore_color = $_GET['fg'];
} else {
    $fore_color = 0x000000;
}
    
if (isset($_GET['bg'])&&!empty($_GET['bg'])) {
    $back_color = $_GET['bg'];
} else {
    $back_color = 0xFFFFFF;
}

QRcode::png($_GET['url'], false, $_GET['err'], $_GET['size'], $_GET['pixel'], false, $back_color, $fore_color);

This works perfectly for url, err, size and pixel but as soon as I try and set the colours from the URL - the respective colour change (fg or bg) just defaults to black.

However, if the variables $fore_color or $back_color are set explicitly (not through the URL and use the else statement then they work. (I should note that if you look at the above they will default to black FG and white BG if the param isn't set).

I have echo'd out the $fore_color and $back_color to check the values are being passed correctly and they are showing up exactly as expected - this behaviour occurs when one or both of the color params are populated in the URL.

I set up a few examples here:

http://rd.exitex.com/qr.php?url=test&size=40&pixel=1&err=L&bg=0xFFFFFF&fg=0x000000

http://rd.exitex.com/qr.php?url=test&size=40&pixel=1&err=L&bg=0xFFFFFF

http://rd.exitex.com/qr.php?url=test&size=40&pixel=1&err=L&fg=0x000000

http://rd.exitex.com/qr.php?url=test&size=40&pixel=1&err=L

Any advice as to this strange behaviour please advise.

Laravel Package?

Any plans to create a laravel package version of this library?

php wkhtmltopdf

I render simply inner HTML via phpwkhtmltopdf, but I have a problem with QR code.

<?php
    ini_set("memory_limit", "128M");
    ini_set('display_errors', '1');
    error_reporting(E_ALL);

    require __DIR__ . '/wkhtmltopdf/autoload.php';
    require_once ('phpqrcode-master/qrlib.php');
    use mikehaertl\wkhtmlto\Pdf;

$svg_QR_Code = QRcode::svg('PHP QR Code :)');

    $pdf = new Pdf;
    $pdf->addPage('

    <html>
    <head>
    </head>
     <body>
     <div id="qr-picture">' .$svg_QR_Code. '  </div>
    </body>
    </html>
');
  1. problem is, that the QRcode image is rendered even if I not use the variable
  2. and unfortunately is rendered the QR image only without my html
    Thank You

eps file not correct

image

    $bg = hexdec('ffffff');
    var_dump($bg);
    if(isset($_GET['bg']))
        $bg = hexdec(trim($_GET['bg']));

    $fg = hexdec('000000');
    if(isset($_GET['fg']))
        $fg = hexdec(trim($_GET['fg']));


    if($vect_format == 'eps'){
        $filename = md5($_GET['data'].'|'.$eccLevel.'|'.$matrixPointSize).'.eps';
        $filepath = $PNG_TEMP_DIR.$filename;
        QRcode::eps($_GET['data'], $filepath, $eccLevel, $matrixPointSize, 2, true, $bg ,$fg); 
    }

the exported eps seems not correct

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.