Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional text to the QR #35

Closed
tkoszo opened this issue Jun 18, 2019 · 13 comments
Closed

Additional text to the QR #35

tkoszo opened this issue Jun 18, 2019 · 13 comments

Comments

@tkoszo
Copy link

tkoszo commented Jun 18, 2019

Is it possible to add additional text to the QR image or under of the QR code?

@codemasher
Copy link
Member

How exactly do you mean? Can you please provide an example?

@tkoszo
Copy link
Author

tkoszo commented Jun 21, 2019

! [QR example] (https://user-images.githubusercontent.com/11610896/59944049-19ae3b00-9464-11e9-9438-87f83ca0a37a.jpg)

I'm looking for something like the attached image as a QR code with some different text (value) as an ID or title, name. It's much easier to identify QR codes when printing out them if we have some additional text on it.

@codemasher
Copy link
Member

Ah, thank you! That's quite simple. You could either extend QRImage (or QRImagick respectively) and create a new image with your text and copy the qrcode into it, or you can use the return value of the dump() method to do the same externally. I could provide you with a simple example tomorrow.

codemasher added a commit that referenced this issue Jun 22, 2019
@codemasher
Copy link
Member

codemasher commented Jun 22, 2019

So i made a little example with room for improvements (unicode, font size, true type font etc.) but i think you get the gist of it: QRImageWithText and imageWithText.php. Good luck!

image

@tkoszo
Copy link
Author

tkoszo commented Jun 23, 2019

Woww, thank you very much for the example and help! :)

@tkoszo tkoszo closed this as completed Jun 23, 2019
@tkoszo tkoszo reopened this Jun 28, 2019
@tkoszo
Copy link
Author

tkoszo commented Jun 28, 2019

Could you please check this as using your example giving this error and not sure where to fix.
2019-06-28

@codemasher
Copy link
Member

Do you by chance have the full debug output and/or your code that causes it?

@ilkerkocatepe
Copy link

Hello,
Firstly thank you for this generator.
I have a problem with ImageWithText.
I have no problem with normal Image Generator; but when I tried the image with text, don't show anything.
Best regards

@codemasher
Copy link
Member

@ilkerkocatepe what exactly is the problem? I just ran that example locally and it seems to work fine. (hint: outcomment the header('Content-type: image/png'); line to see the error message if you're running the example in a browser).

@ilkerkocatepe
Copy link

ilkerkocatepe commented May 21, 2020

Hi again, I'm using example code.
Error is:
Fatal error: Uncaught Error: Class 'chillerlan\QRCode\QRImageWithText' not found

I'm getting this. Thank you.

@codemasher
Copy link
Member

Ah, this helps! It is because this an example and the class is in the chillerlan\QRCodeExamples namespace, which is only loaded with dev dependencies. You would need to create this class in your own applications namespace (copy the example class and change its namespace to your application's) and run it from there.

@ilkerkocatepe
Copy link

Thank you @codemasher It's great. It solved 👌

@codemasher
Copy link
Member

Happy to help!

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

No branches or pull requests

3 participants