Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Change QR Code colors #89

mihail-minkov started this conversation in Ideas
Oct 15, 2021 · 3 comments · 6 replies
Discussion options

In many QR code generators they allow you to change colors for the different elements of the QR Code.

Is this possible here or it could be a future ... feature 😄

You must be logged in to vote

Replies: 3 comments 6 replies

Comment options

Uh that's literally a feature?

You must be logged in to vote
1 reply
Comment options

Well, I can't seem to find an example of that. Things like specific colors for specific squares, etc. Could you point me in the right direction?

Comment options

It's all in the /examples directory. https://github.com/chillerlan/php-qrcode/blob/main/examples/image.php
In case you want to color individual pixels, i.e. for a pixel art logo, you will need to extend the respective output module similar to this example: https://github.com/chillerlan/php-qrcode/blob/main/examples/QRImageWithLogo.php

You must be logged in to vote
0 replies
Comment options

Hello,

Could you provide the options to generate a QRCode like the beautiful rainbow one that you present on the homepage ?
I tried many things using the examples but mines are horrible... i can't reproduce a nice QRCode. Especially to have circular spaced dot ...

Thanks for helping

You must be logged in to vote
5 replies
Comment options

Hey, it's in the SVG example of the current main branch, install it with the following composer.json to fetch the correct version:

{
	"require": {
		"php": "^7.4",
		"chillerlan/php-qrcode": "dev-main#06730361508c283a02bbf9cbc9e4b55e7b3bc88b"
	}
}
Comment options

Hey, thanks for reply so fast.

I confirm that the code is working with the main branch but in my project I took the version ^4.3 with composer as I am working with php 7.4.. And in that branch of course the variables are not the same "EccLevel::L and QRMatrix::IS_DARK" are undefined :)

I thought that I should not be using the "dev-main" branch for prod environment ? What do you recommend ?


Last question, I would like to render the QR code in a php function that does other things (like retrieve an article for the DB). Because I wanted to add the generated qr_code SVG as a variable and then display it in the view. But this is not working.
I mean the render only works when I call a specific route for the generator with the headers. But I want to generate it in my controller and not in the view.

Comment options

Hey, thanks for reply so fast.

I confirm that the code is working with the main branch but in my project I took the version ^4.3 with composer as I am working with php 7.4.. And in that branch of course the variables are not the same "EccLevel::L and QRMatrix::IS_DARK" are undefined :)

I thought that I should not be using the "dev-main" branch for prod environment ? What do you recommend ?

The QR Code generator is almost done, the pending changes will mostly affect the reader/decoder which was not part of the library previously. So at this point it's quite safe to use dev-main and later upgrade to v5 once it's released without breaking anything (granted that it's in your own project and you can easily upgrade).

Last question, I would like to render the QR code in a php function that does other things (like retrieve an article for the DB). Because I wanted to add the generated qr_code SVG as a variable and then display it in the view. But this is not working. I mean the render only works when I call a specific route for the generator with the headers. But I want to generate it in my controller and not in the view.

What exactly is the question here? Where to put the QR output? Like, retrieve the data from the controller/model and render in the view? Or render in the controller and hand over the data blob to the view?

Comment options

The QR Code generator is almost done, the pending changes will mostly affect the reader/decoder which was not part of the library previously. So at this point it's quite safe to use dev-main and later upgrade to v5 once it's released without breaking anything (granted that it's in your own project and you can easily upgrade).

Great news ! I'll stay on the dev-main and then switch to v5 as suggested !

What exactly is the question here? Where to put the QR output? Like, retrieve the data from the controller/model and render in the view? Or render in the controller and hand over the data blob to the view?

Sorry for confusion, hard to be clear as I'm not a native english. But forget about that, the QR code was not displayed on the view because of CSS issues. It's well displayed somewhere else on the page :)

Big thank for your time, and your work on this amazing project, but I don't thank you for having been Rick Rolled ^_^

Comment options

Big thank for your time, and your work on this amazing project, but I don't thank you for having been Rick Rolled ^_^

Happy to help! Also, one shall appreciate the rickroll as it is one of the most wholesome memes on the internet and as it turns out, Rick Astley is a gem of a human :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /