Open danielmreck opened 3 years ago
I agree, but I also found some nice example codes:
I'm open to accepting pull requests.
I am struggling with using modules and gradients, among other things. Ive managed to use background, foreground and eye colors, but that's about it. Documentation and working examples would be very welcome.
My code for now:
<?php
require 'vendor/autoload.php';
use BaconQrCode\Renderer\ImageRenderer;
use BaconQrCode\Renderer\Image\ImagickImageBackEnd;
use BaconQrCode\Renderer\RendererStyle\RendererStyle;
use BaconQrCode\Renderer\RendererStyle\Fill;
use BaconQrCode\Writer;
$backgroundColor = new \BaconQrCode\Renderer\Color\Rgb(255, 255, 255);
$foregroundColor = new \BaconQrCode\Renderer\Color\Rgb(1, 101, 185);
$eyeColor = new \BaconQrCode\Renderer\Color\Rgb(254,145,2);
$eyeFill = new BaconQrCode\Renderer\RendererStyle\EyeFill($eyeColor, $eyeColor);
$fill = Fill::withForegroundColor($backgroundColor, $foregroundColor, $eyeFill, $eyeFill, $eyeFill);
$renderer = new ImageRenderer(
new RendererStyle(300, 0, null, null, $fill),
new ImagickImageBackEnd()
);
$writer = new Writer($renderer);
$writer->writeFile('https://www.youtube.com/watch?v=EKLnEQWOYwI', './temp/qrcode.png');
?>
<img src="/temp/qrcode.png" alt="">
Do we have more thorough documentation available beyond what's in README.md? I've searched up and down and most of the examples I find elsewhere seem to rely on the previous version and do not work with 2.0.0.
For instance, I'd like to change the foreground and background colors of the QR code. The constructor for
RendererStyle
in RendererStyle.php appears to provide access for this in the fifth argument. In theFill
constructor in Fill.php there are references to foregroundColor and backgroundColor.However, I cannot determine the combination of
use
statements, classes, and method calls required to actually set the colors. May we have a bit of documentation added to README.md or the wiki demonstrating this functionality?Likewise, is there information about setting the bit-depth of generated PNGs? The default output is not compatible with FPDF.
Thank you.