mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-30 03:58:28 +00:00
:octocat: allow base64 output for the fpdf module
This commit is contained in:
@@ -13,6 +13,7 @@ $options = new QROptions([
|
||||
'outputType' => QRCode::OUTPUT_FPDF,
|
||||
'eccLevel' => QRCode::ECC_L,
|
||||
'scale' => 5,
|
||||
'imageBase64' => false,
|
||||
'moduleValues' => [
|
||||
// finder
|
||||
1536 => [0, 63, 255], // dark (true)
|
||||
|
||||
@@ -102,6 +102,10 @@ class QRFpdf extends QROutputAbstract{
|
||||
$this->saveToFile($pdfData, $file);
|
||||
}
|
||||
|
||||
if($this->options->imageBase64){
|
||||
$pdfData = sprintf('data:application/pdf;base64,%s', base64_encode($pdfData));
|
||||
}
|
||||
|
||||
return $pdfData;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,8 @@ class QRFpdfTest extends QROutputTestAbstract{
|
||||
* @dataProvider types
|
||||
*/
|
||||
public function testRenderImage(string $type):void{
|
||||
$this->options->outputType = $type;
|
||||
$this->options->outputType = $type;
|
||||
$this->options->imageBase64 = false;
|
||||
|
||||
// substr() to avoid CreationDate
|
||||
$expected = substr(file_get_contents(__DIR__.'/samples/'.$type), 0, 2500);
|
||||
|
||||
Reference in New Issue
Block a user