endroid / qr-code Goto Github PK
View Code? Open in Web Editor NEWQR Code Generator
Home Page: https://endroid.nl
License: MIT License
QR Code Generator
Home Page: https://endroid.nl
License: MIT License
Hello!
If image size is not set, it is detected automatically. Auto detection uses module size and the number of modules. That's good idea but it seems that detected size is not optimal so image is scaled/distorted a bit. For example, if there are 33x33 modules and module size is 1, auto detected size is 41x41 instead of 33x33.
I debugged this problem and found that size autodetection works this way:
$mib = $max_modules_1side + 8;
$this->size = $mib * $qrcode_module_size;
Seems that cause of this issues is addition of 8. Is it really needed?
Regards
Is there any support for CMYK or Spot color instead of RGB?
I believe this would be a huge help in the print industry.
In Laravel 5.1
I'm using the same code, but I can't get the image I'm get this code . . . And is NOT base64 code . . .
�PNG � IHDR�@�Z�����d!PLTE������������___???��ߟ������Ǧ��IDATx���;o�A��aP�(����N�1�L��HIZ��=�N.���8J$�P���H��+3���%�a���߯�b����+#֙!����|�X����� @��������ٜ�ihR�M:�z��� @���������W�"�F������� ��EnV_��� @��������0g�� @�����p�@Sl~�J���[){��� @���SD��O�d
������� @�O������gu^��5]��5]��5]�g��]>���09�J�t�X�� @������Y�(�W����7 @�����p���},���Nl�� ��#���� @���(V���c��L��r� � @����(�S�b[V��z��@������ ���GgK�J�7�ȕ"]��5]��5]��5�}R�ĵ�����d�� @����h������7T4$�d�1�Z����� @����KYigQh���f����� @�w�4U��,��W @��������М}��MX����� @�� h�q��2���e��� @����h�L���H6��E����@����������B�!���e��,�ۭ��u^�����_������K+8��_�����^_59+t��T�-Wa�F�O�o��i��_�T���,���֫����۲֖��7�U��G^�ͱR_;�nQ�fuy4��n0Sz�6߫v�+�WR�Z����5�-�׃��UWz�w�^��}���'#�Z����|~R��)Z� T��1��fA�]\�W��
�]����A��8�M��ث��1����q������l�/��v+�j씢s������苴>����8�4��_�]$G�E���*V#�t��4��w�~�iF�����T�q�l���٫܇��,�7������x=����Z��?��ɠ[���~��w>���_����P�䍷�v���-0��m�7����O� �<���Qt&7τ\�IEND�B
�
How can the margin be removed? I'd like to make the code fit all the available space, without the extra blank space.
Thanks!
I got following error:
PHP Notice: Undefined offset: 15 in /var/www/html/qrservice/vendor/endroid/qrcode/src/Endroid/QrCode/QrCode.php on line 1183
PHP Version:
PHP 5.5.23 (cli) (built: Mar 21 2015 22:04:59)
Copyright (c) 1997-2015 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2015 Zend Technologies
there is no any explanation of possible commands at this moment,
had to read through source code in order to find how to save files.
having some detailed commands/possibilities list could be very useful.
Fatal error:
500 Internal Server Error - FatalThrowableError
in vendor/endroid/qrcode/src/QrCode.php at line 1200
could you please add require 'vendor/autoload.php'; to your example. Without it, it will not work.
Just these, because some times some app for read codes needs a border because the background can have colors that make interferences
thanks !
I try to render on twig with dataUri but dont show nothing, broken image...
data:image/png;base64,ZGF0YTppbWFnZS9wbmc7YmFzZTY0LGlWQk9SdzBLR2dvQUFBQU5TVWhFVWdBQUFVQUFBQUZVQkFNQUFBQ24rZmdVQUFBQUcxQk1WRVgvLy84QUFBQ2ZuNSsvdjc5L2YzOC9QejhmSHg5ZlgxL2YzOThQMmIzTEFBQUFBblJTVGxQOS9SU04zR2tBQUFOQ1NVUkJWSGljN2RxL1Q5dEFHTWJ4U3h3N0htMnBSUm16d0p3bHpLN1U3b2dDNm1pUnhzMUlHVkJHTXdEOXMzdVhVSUx0MTRkL0JDZWszMGVnWE03Y3ZSOGJPenJaVVlvUVFnaHBuN0IyYkFPRDliWmU1bDN6R2dBQkFnUUlFQ0JBZ0ZXQjZ1MzBiRURyeU1ZMUFBSUVDQkFnUUlBQWF3SkRLVUhwNE1JMDJSRmJxUUVRSUVDQUFBRUNCUGcrUUpIYmt3WUNCQWdRSUVDQUFBRUMzREp3NzllREFBRUNCQWdRSU1CREJkcXlGOC9xQUFJRUNCQWdRSUFBWldDTmlGV2YzMlZYVFVIYkdnQUJBZ1FJRUNCQWdCOGYyRGJaaVdYZ1RnT3diUUMyRGNDMkFkZzJBTnNHWU52c0JoaEtCWVE3VH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VKb0VrTEl2dWN2UC9JOFpnNWpMQ1VBQUFBQVNVVk9SSzVDWUlJPQ==
In QrCode/src/Factory/QrCodeFactory.php in getAvailableOptions() function, the 'padding' option is omitted.
This error was generate in Symphony when I use the padding option : An exception has been thrown during the rendering of a template ("The option "padding" does not exist. Defined options are: "background_color", "error_correction_level", "extension", "foreground_color", "label", "label_font_path", "label_font_size", "size", "text".")
I'm sure i'm not the only one wanting this - could you include instructions in the readme for utilisation without Composer?
Deeply dislike dependency managers, but would like to use this, but it's not entirely clear on what I should be linking in my require statement.
I can't use UTF-8 for Chinese
Could you fix it ?
tks ,i'm waiting for you
You jump, I jump!
tks again
I tried generating a QR Code for a larger block of text while testing, and found that it didn't generate correctly.
Praesent commodo cursus magna, vel scelerisque nisl consectetur et. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Vestibulum id ligula porta felis euismod semper. Donec id elit non mi porta gravida at eget metus. Donec sed odio dui. Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Cras justo odio, dapibus ac facilisis in, egestas eget quam. Nullam quis risus eget urna mollis ornare vel eu leo. Aenean lacinia bibendum nulla sed consectetur. Donec sed odio dui. Nulla vitae elit libero, a pharetra augue. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
The generated QR Code won't scan.
Hello man, how can we hide of the Qrcode so that another application can't print it? I am building an application for aunthentication using your library to store user information, but I dont want other application to see the content when they scan it??
Not everyone use composer, so please add a manual installation guide, or at least a folder that we can drag&drop in our projects, thanks 😃
It's ok last few days, but today I got this problem and it can' generate the qrcode image for me, and before this I din't change anything, actually there is no file named rsc0.dat in the path, below is my code :
$qrCode = new QrCode();
$qrCode
->setText($string)
->setSize(300)
->setPadding(10)
->setErrorCorrection('high')
->setForegroundColor(array('r' => 0, 'g' => 0, 'b' => 0, 'a' => 0))
->setBackgroundColor(array('r' => 255, 'g' => 255, 'b' => 255, 'a' => 0))
//->setLabel($label)
//->setLabelFontSize(16)
->setImageType(QrCode::IMAGE_TYPE_PNG)
;
return $qrCode;
what's wrong with me ?
parameters:
$string = 'I864';
$label = '';
Can you please add a feature where we can export QR codes as SVG, That way we can export images that are small in file size and does not pixelate!
Great library!
Hello, when I set when Chinese is garbled, I do not know how to solve? Thank you!
at this moment all qr codes are generated as TXT-type,
which prevents them from accessing URLS through scanning
in SOME popular scanning software, as TXT-type QR
is treated as simple text string not an URL.
yes, there is a difference between them.
The package works brilliantly.
The only thing I noticed is that it is loading tests on autoload and it shouldn't (imo, it represents unnecessary memory loaded to PHP for production purposes).
Regards.
I just have installed QrCode ("endroid/qrcode": "^1.5")
I have the error :
Attempted to call function "imagecreate" from namespace "Endroid\QrCode".
500 Internal Server Error - UndefinedFunctionException
What am I missing ?
Vector formats are useful for QR Codes. Given the popularity and browser support of SVG, I think many people would like to have SVG output in this project.
Can we get a getter to retrieve the image resource, or make create()
return it?
public function getResource()
{
if (empty($this->image)) {
$this->create();
}
return $this->image;
}
ImageCreate, ImageCreateFromPng, ImageColorAllocate, ImageSetPixel and ImageCopyResized should be lowercase in create function of QrCode.php
now I'm using the symfony bundle you provided,now I want to have this bundle tested,I 'm not that familiar with phhunit,my command is:
phpunit-5.3.4 -c vendor/endroid/qrcode --bootstrap vendor/autoload.php vendor/endroid/qrcode/tests/
but it reports error like 'Error: Class 'Endroid\QrCode\QrCode' not found' and another two class not found error,what is the correct way to test a package ?
thank for you attention!
Hi.
Did this library supports the ISO/IEC18004:2000 standard?
Thanks.
The QR generator refuses to generate codes with over 1000 characters.
QR codes in general are able to produce: 4,296 alphanumeric characters. The plugin should be made to fit with the standards and allow as many characters as the standard allows.
http://www.qrcode.com/en/about/version.html
Hi there! Great library! What about moving the Symfony bundle in another package? In addition, I would add more configuration like this:
endroid_qr_code:
my_qr1:
size: 100
padding: 10
extension: gif
error_correction_level: medium
foreground_color: { r: 0, g: 0, b: 0, a: 0 }
background_color: { r: 255, g: 255, b: 255, a: 0 }
label: 'My label'
label_font_size: 16
myqr2:
size: 250
padding: 10
error_correction_level: high
# ...
$this->get('endroid_qrcode.myqr2')->createQrCode();
imagecolorset supports an alpha channel in PHP 5.4+. It would be nice if this could be included for background/foreground colors. I know this library claims PHP 5.3+ compatibility, so it would either need to be bumped, or PHP 5.4 detection could be done in the code to allow for alpha.
$image_info = getimagesize ( $this->logo ); if ($image_info !== false) { $image_type = strtolower ( substr ( image_type_to_extension ( $image_info [2] ), 1 ) ); $logo_image = call_user_func('imagecreatefrom'.$image_type, $this->logo); } else { $logo_image = call_user_func('imagecreatefrom'.$this->image_type, $this->logo); }
There are semicolons on several lines, causing PHP errors. It should read like so:
use Endroid\QrCode\QrCode;
$qrCode = new QrCode();
$qrCode
->setText("Life is too short to be generating QR codes")
->setSize(300)
->setPadding(10)
->setErrorCorrection('high')
->setForegroundColor(array('r' => 0, 'g' => 0, 'b' => 0, 'a' => 0))
->setBackgroundColor(array('r' => 255, 'g' => 255, 'b' => 255, 'a' => 0))
->render();
In your example you set the label as ->setLabel('Scan the code')
but the QR code label is output as "Label" which some might find confusing.
i want to show chinese label
It would be nice if in QrCode::render
function, an Exception is thrown if the call_user_func(_array)
returns false
instead of true
.
If you try to render an http address with these params:
$defaultOptions = [
'text' => 'http://www.example.com/it/it/contact/qr/hit/id/1 ',
'ext' => 'png',
'size' => 300,
'padding' => 10,
'destDir' => APPLICATION_PATH . "/../public/cache/qrcode",
'backgroundColor' => [
'r' => 255,
'g' => 255,
'b' => 255,
'a' => 0],
'foregroundColor' => [
'r' => 0,
'g' => 0,
'b' => 0,
'a' => 0],
'errorCorrection' => \Endroid\QrCode\QrCode::LEVEL_MEDIUM,
];
it will thow an Exception:
Undefined offset: 43 in /var/www/vhosts/vimarcom/webroot/vendor/endroid/qrcode/src/QrCode.php on line 1150.
It works fine with other ERROR LEVELS.
composer install:
try:
composer require "endroid/qrcode"
composer require endroid/qrcode:1.6.2
composer require "endroid/qrcode:dev-master" --prefer-dist
composer require "endroid/qrcode:dev-master" --prefer-source
Problem 1
- The requested package endroid/qrcode could not be found in any version, there may be a typo in the package name.
Potential causes:
Read https://getcomposer.org/doc/articles/troubleshooting.md for further common problems.
Is http://endroid.nl/ site blank?
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Welcome!</title>
<link rel="stylesheet" type="text/css" href="/assets/css/bundled.min.css">
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
</head>
<body>
<script src="/assets/js/bundled.min.js"></script>
</body>
</html>
I can't get the document.
hi, i run the code below:
$qrCode = new QrCode();
$qrCode -> setText('hzd')
-> setSize(300)
-> setPadding(10)
-> setErrorCorrection('high')
-> setForegroundColor(array('r'=>0, 'g'=>0, 'b'=>0, 'a'=>0))
-> setBackgroundColor(array('r'=>255, 'g'=>255, 'b'=>255, 'a'=>0))
-> render();
i got a error:
PHP Fatal error: Call to undefined function Endroid\QrCode\imagecreatefrompng() in /usr/local/var/www/QrCode/src/Endroid/QrCode/QrCode.php on line 1101
thanks.
It would be great to have a possibility to change QR types like url or other. I think, most people use QR for links, and scanners do differ URLs and text.
Hi,
How can I change the color of the Lablel?
Thx
G
It would be much better if all parameters of qrcode could be set using setters. There is setSize($size), but is never used during generation of qrcode.
When we set a tiny text , QR code cannot be generated
use Endroid\QrCode\QrCode;
$qrCode = new QrCode();
$qrCode
->setText('test')
->setSize(300)
->setPadding(10)
->setErrorCorrection('high')
->setForegroundColor(['r' => 0, 'g' => 0, 'b' => 0, 'a' => 0])
->setBackgroundColor(['r' => 255, 'g' => 255, 'b' => 255, 'a' => 0])
->setLabel('Scan the code')
->setLabelFontSize(16)
->setImageType(QrCode::IMAGE_TYPE_PNG)
;
// now we can directly output the qrcode
header('Content-Type: '.$qrCode->getContentType());
$qrCode->render();
Error is :
Warning: fopen(vendor\endroid\qrcode\src/../assets/data/rsc0.dat): failed to open stream: No such file or directory in vendor\endroid\qrcode\src\QrCode.php on line 1130
this package is all about generating the qrcode if i'm not mistaken. how do i read back the qrcode? is there any way to scan it back.
As the request in Title. Now I need to create an qrcode image with an lucency background. But I could not found any feature to do in this lib. Does I missing something?
Hope to get you help quickly.
Best Wishes.
All I get when using this library is:
�PNG � IHDR������<��PLTE���U��~�5IDATX�혱��0D)�H��<�F�G�(��e ����������rE�蹑�;Q��I���X��Y90��d����G0�t��� &n�O���际���H&�t+��� ��,p�o��-&�������vDri���S<�e�t�)j�Yl��D�R�x��x��U���2�����e��X�p[��Q��}-C��ʫ ��ᕀXZV��0E����Ą���v(��311�3>����ǜ�LD��ie�3�ʪ��ڵ��q�l)���ՋE&����a���5�ʝ�dv�������HC�9ʙ?� K�t5\��l0�����W~%��F���෴�>�L��OO�i���E��IEND�B
�
What am I doing wrong? Am i missing a library? I'm not seeing any error messages...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.