Skip to content

Compress QR code #102

@maxpelic

Description

@maxpelic

The QR code generator function does not compress the data at all, changing it to something like

    {
        $width = $this->getModuleCount() * $size;
        $height = $width;
        print('<svg width="' . $width . '" height="' . $height . '" xmlns="http://www.w3.org/2000/svg"><path d="');
        for ($r = 0; $r < $this->getModuleCount(); $r++) {
            for ($c = 0; $c < $this->getModuleCount(); $c++) {
                if(!$this->isDark($r, $c)) continue;
                print('M' . ($c * $size) . ' ' . ($r * $size) . "h{$size}v{$size}h-{$size}z");
            }
        }

        print("\"></path></svg>");
    }

makes the output data waaaaay smaller while still printing the same thing (it has a transparent background but that could easily be changed by just adding a white rect first).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions