mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-30 03:58:28 +00:00
:octocat: +data-uri/base64 for SVG
This commit is contained in:
@@ -33,6 +33,8 @@ class QRImage extends QROutputAbstract{
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*
|
||||
* @throws \chillerlan\QRCode\QRCodeException
|
||||
*/
|
||||
public function __construct(SettingsContainerInterface $options, QRMatrix $matrix){
|
||||
|
||||
@@ -115,7 +117,7 @@ class QRImage extends QROutputAbstract{
|
||||
$this->saveToFile($imageData, $file);
|
||||
}
|
||||
|
||||
if((bool)$this->options->imageBase64){
|
||||
if($this->options->imageBase64){
|
||||
$imageData = sprintf('data:image/%s;base64,%s', $this->options->outputType, base64_encode($imageData));
|
||||
}
|
||||
|
||||
|
||||
@@ -150,6 +150,10 @@ class QRMarkup extends QROutputAbstract{
|
||||
$this->options->eol.$svg;
|
||||
}
|
||||
|
||||
if($this->options->imageBase64){
|
||||
$svg = sprintf('data:image/svg+xml;base64,%s', base64_encode($svg));
|
||||
}
|
||||
|
||||
return $svg;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user