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

replace Endroid\QrCode with BaconQrCode #8173

Merged
merged 1 commit into from
Aug 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ complete: roundcubemail-git
(cd roundcubemail-$(VERSION); php /tmp/composer.phar install --prefer-dist --no-dev --ignore-platform-reqs)
(cd roundcubemail-$(VERSION); bin/install-jsdeps.sh --force)
(cd roundcubemail-$(VERSION); bin/jsshrink.sh program/js/publickey.js; bin/jsshrink.sh plugins/managesieve/codemirror/lib/codemirror.js)
(cd roundcubemail-$(VERSION); rm jsdeps.json bin/install-jsdeps.sh *.orig; rm -rf vendor/masterminds/html5/test vendor/pear/*/tests vendor/*/*/.git* vendor/pear/crypt_gpg/tools vendor/pear/console_commandline/docs vendor/pear/mail_mime/scripts vendor/pear/net_ldap2/doc vendor/pear/net_smtp/docs vendor/pear/net_smtp/examples vendor/pear/net_smtp/README.rst vendor/endroid/qrcode/tests temp/js_cache)
(cd roundcubemail-$(VERSION); rm jsdeps.json bin/install-jsdeps.sh *.orig; rm -rf vendor/masterminds/html5/test vendor/pear/*/tests vendor/*/*/.git* vendor/pear/crypt_gpg/tools vendor/pear/console_commandline/docs vendor/pear/mail_mime/scripts vendor/pear/net_ldap2/doc vendor/pear/net_smtp/docs vendor/pear/net_smtp/examples vendor/pear/net_smtp/README.rst vendor/bacon/bacon-qr-code/test temp/js_cache)
tar czf roundcubemail-$(VERSION)-complete.tar.gz roundcubemail-$(VERSION)
rm -rf roundcubemail-$(VERSION)

Expand Down
1 change: 1 addition & 0 deletions bin/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ if ($RCI->configured) {
'pear/mail_mime-decode',
'roundcube/net_sieve',
'endroid/qrcode',
'endroid/qr-code',
];

foreach ($old_packages as $pkg) {
Expand Down
2 changes: 1 addition & 1 deletion composer.json-dist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"roundcube/plugin-installer": "~0.3.0",
"roundcube/rtf-html-php": "~2.1",
"masterminds/html5": "~2.7.0",
"endroid/qr-code": "~1.6.5",
"bacon/bacon-qr-code": "^2.0.0",
"guzzlehttp/guzzle": "^6.5.5"
},
"require-dev": {
Expand Down
4 changes: 2 additions & 2 deletions program/actions/contacts/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,9 @@ public function run($args = [])
'searchform' => [$rcmail->output, 'search_form']
]);

// Disable qr-code if php-gd or Endroid's QrCode is not installed
// Disable qr-code if imagick, iconv or BaconQrCode is not installed
if (!$rcmail->output->ajax_call) {
$rcmail->output->set_env('qrcode', function_exists('imagecreate') && class_exists('Endroid\QrCode\QrCode'));
$rcmail->output->set_env('qrcode', extension_loaded('imagick') && extension_loaded('iconv') && class_exists('BaconQrCode\Renderer\ImageRenderer'));
$rcmail->output->add_label('qrcode');
}
}
Expand Down
18 changes: 6 additions & 12 deletions program/actions/contacts/qrcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,11 @@ public static function contact_qrcode($contact)

$data = $vcard->export();

$qrCode = new Endroid\QrCode\QrCode();
$qrCode
->setText($data)
->setSize(300)
->setPadding(0)
->setErrorCorrection('high')
// ->setLabel('Scan the code')
// ->setLabelFontSize(16)
->setForegroundColor(['r' => 0, 'g' => 0, 'b' => 0, 'a' => 0])
->setBackgroundColor(['r' => 255, 'g' => 255, 'b' => 255, 'a' => 0]);

return $qrCode->get('png');
$renderer = new BaconQrCode\Renderer\ImageRenderer(
new BaconQrCode\Renderer\RendererStyle\RendererStyle(300, 1),
new BaconQrCode\Renderer\Image\ImagickImageBackEnd()
);
$writer = new BaconQrCode\Writer($renderer);
return $writer->writeString($data);
}
}