Closed johnny-silverhand closed 2 years ago
The code below outputs a QR code without a logo. I could use a PngWriter and a PNG logo, but I need a high quality result.
source code from documentation
$result = Builder::create() ->writer(new SvgWriter()) ->writerOptions([]) ->data('Custom QR code contents') ->encoding(new Encoding('UTF-8')) ->errorCorrectionLevel(new ErrorCorrectionLevelHigh()) ->size(300) ->margin(10) ->roundBlockSizeMode(new RoundBlockSizeModeMargin()) ->logoPath(__DIR__.'/../assets/clear-logo.svg') ->logoResizeToHeight(100) ->logoResizeToWidth(100) ->labelText('This is the label') ->labelFont(new NotoSans(20)) ->labelAlignment(new LabelAlignmentCenter()) ->build();
clear-logo.svg
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg"> <rect width="48" height="39" fill="#050038"/> <rect x="7.19995" y="9" width="32.4" height="3" fill="white"/> <rect x="7.19995" y="18" width="32.4" height="3" fill="white"/> <rect x="7.19995" y="27" width="21.6" height="3" fill="white"/> <path d="M7.19995 39H14.4L7.19995 48V39Z" fill="#050038"/> </svg>
The code below outputs a QR code without a logo. I could use a PngWriter and a PNG logo, but I need a high quality result.
source code from documentation
clear-logo.svg