mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-30 20:17:17 +00:00
🚿 updated examples
This commit is contained in:
@@ -12,11 +12,11 @@
|
||||
|
||||
namespace chillerlan\QRCodeExamples;
|
||||
|
||||
use chillerlan\QRCode\Output\{QRCodeOutputException, QRImage};
|
||||
use chillerlan\QRCode\Output\{QRGdImage, QRCodeOutputException};
|
||||
|
||||
use function imagecopyresampled, imagecreatefrompng, imagesx, imagesy, is_file, is_readable;
|
||||
|
||||
class QRImageWithLogo extends QRImage{
|
||||
class QRImageWithLogo extends QRGdImage{
|
||||
|
||||
/**
|
||||
* @param string|null $file
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
|
||||
namespace chillerlan\QRCodeExamples;
|
||||
|
||||
use chillerlan\QRCode\Output\QRImage;
|
||||
|
||||
use chillerlan\QRCode\Output\QRGdImage;
|
||||
use chillerlan\QRCode\QRCode;
|
||||
use function imagechar, imagecolorallocate, imagecolortransparent, imagecopymerge, imagecreatetruecolor,
|
||||
imagedestroy, imagefilledrectangle, imagefontwidth, in_array, round, str_split, strlen;
|
||||
imagedestroy, imagefilledrectangle, imagefontwidth, round, str_split, strlen;
|
||||
|
||||
class QRImageWithText extends QRImage{
|
||||
class QRImageWithText extends QRGdImage{
|
||||
|
||||
/**
|
||||
* @param string|null $file
|
||||
@@ -74,7 +74,7 @@ class QRImageWithText extends QRImage{
|
||||
$background = imagecolorallocate($this->image, ...$textBG);
|
||||
|
||||
// allow transparency
|
||||
if($this->options->imageTransparent && in_array($this->options->outputType, $this::TRANSPARENCY_TYPES, true)){
|
||||
if($this->options->imageTransparent && $this->options->outputType !== QRCode::OUTPUT_IMAGE_JPG){
|
||||
imagecolortransparent($this->image, $background);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,20 +10,24 @@ namespace chillerlan\QRCodeExamples;
|
||||
|
||||
use chillerlan\QRCode\{QRCode, QROptions};
|
||||
use chillerlan\QRCode\Common\EccLevel;
|
||||
use chillerlan\QRCode\Data\QRMatrix;
|
||||
|
||||
require_once __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
|
||||
$data = 'https://github.com';
|
||||
|
||||
$options = new QROptions([
|
||||
'version' => 7,
|
||||
'eccLevel' => EccLevel::H,
|
||||
'imageBase64' => false,
|
||||
'addLogoSpace' => true,
|
||||
'logoSpaceWidth' => 13,
|
||||
'logoSpaceHeight' => 13,
|
||||
'scale' => 5,
|
||||
'imageTransparent' => false,
|
||||
'version' => 5,
|
||||
'eccLevel' => EccLevel::H,
|
||||
'imageBase64' => false,
|
||||
'addLogoSpace' => true,
|
||||
'logoSpaceWidth' => 13,
|
||||
'logoSpaceHeight' => 13,
|
||||
'scale' => 6,
|
||||
'imageTransparent' => false,
|
||||
'drawCircularModules' => true,
|
||||
'circleRadius' => 0.45,
|
||||
'keepAsSquare' => [QRMatrix::M_FINDER, QRMatrix::M_FINDER_DOT],
|
||||
]);
|
||||
|
||||
$qrcode = new QRCode($options);
|
||||
|
||||
@@ -14,12 +14,13 @@ use chillerlan\QRCode\Common\EccLevel;
|
||||
|
||||
require_once __DIR__.'/../vendor/autoload.php';
|
||||
|
||||
$data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
|
||||
$data = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
|
||||
|
||||
$options = new QROptions([
|
||||
'version' => 7,
|
||||
'outputType' => QRCode::OUTPUT_IMAGICK,
|
||||
'eccLevel' => EccLevel::L,
|
||||
'imagickBG' => '#FFFFFF',
|
||||
'scale' => 20,
|
||||
'drawCircularModules' => true,
|
||||
'circleRadius' => 0.4,
|
||||
@@ -37,7 +38,7 @@ $options = new QROptions([
|
||||
QRMatrix::M_TIMING => '#FFB8E9',
|
||||
// format
|
||||
QRMatrix::M_FORMAT | QRMatrix::IS_DARK => '#003804',
|
||||
QRMatrix::M_FORMAT => '#00FB12',
|
||||
QRMatrix::M_FORMAT => '#CCFB12',
|
||||
// version
|
||||
QRMatrix::M_VERSION | QRMatrix::IS_DARK => '#650098',
|
||||
QRMatrix::M_VERSION => '#E0B8FF',
|
||||
|
||||
Reference in New Issue
Block a user