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

[Feature Request] Implement logoPunchoutBackground in SVG writer #455

Open
CodelineRed opened this issue Oct 9, 2024 · 1 comment
Open
Assignees
Labels
enhancement New feature or request

Comments

@CodelineRed
Copy link

logoPunchoutBackground(true) has no effect on SVG files.

Screenshot 2024-10-09 105946

<?php
use Endroid\QrCode\Builder\Builder;
use Endroid\QrCode\Encoding\Encoding;
use Endroid\QrCode\Writer\PngWriter;
use Endroid\QrCode\Writer\SvgWriter;

foreach (['png', 'svg'] as $extension) {
    $generalBuilder = Builder::create();

    if ($extension === 'png') {
        $generalBuilder->writer(new PngWriter());
    } else {
        $generalBuilder->writer(new SvgWriter());
    }

    $generalBuilder->writerOptions([])
        ->data('https://github.com/Bacon/BaconQrCode')
        ->encoding(new Encoding('UTF-8'))
        ->size(320)
        ->margin(10)
        ->logoPath('logo.png')
        ->logoResizeToWidth(100)
        ->logoPunchoutBackground(true);
    }

    $generalBuilder->build()->saveToFile('qrcode.' . $extension);
}

Tested with 5.1.0

@DharmenderRajput
Copy link

Confirmed with v6.0.0

@endroid endroid changed the title SVG and logoPunchoutBackground(true) [Feature Request] Implement logoPunchoutBackground in SVG writer Nov 14, 2024
@endroid endroid self-assigned this Nov 14, 2024
@endroid endroid added the enhancement New feature or request label Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants