mirror of
https://github.com/chillerlan/php-qrcode.git
synced 2026-08-31 20:48:40 +00:00
:octocat: rename QROutputAbstract::base64encode() to toBase64DataURI() to better reflect what it does
This commit is contained in:
@@ -64,7 +64,7 @@ class QRImageWithLogo extends QRGdImage{
|
||||
}
|
||||
|
||||
if($this->options->imageBase64){
|
||||
$imageData = $this->base64encode($imageData, 'image/'.$this->options->outputType);
|
||||
$imageData = $this->toBase64DataURI($imageData, 'image/'.$this->options->outputType);
|
||||
}
|
||||
|
||||
return $imageData;
|
||||
|
||||
@@ -44,7 +44,7 @@ class QRImageWithText extends QRGdImage{
|
||||
}
|
||||
|
||||
if($this->options->imageBase64){
|
||||
$imageData = $this->base64encode($imageData, 'image/'.$this->options->outputType);
|
||||
$imageData = $this->toBase64DataURI($imageData, 'image/'.$this->options->outputType);
|
||||
}
|
||||
|
||||
return $imageData;
|
||||
|
||||
@@ -57,7 +57,7 @@ class RoundQuietzoneSVGoutput extends QRMarkupSVG{
|
||||
|
||||
// transform to data URI only when not saving to file
|
||||
if(!$saveToFile && $this->options->imageBase64){
|
||||
$svg = $this->base64encode($svg, 'image/svg+xml');
|
||||
$svg = $this->toBase64DataURI($svg, 'image/svg+xml');
|
||||
}
|
||||
|
||||
return $svg;
|
||||
|
||||
@@ -106,7 +106,7 @@ class QRFpdf extends QROutputAbstract{
|
||||
}
|
||||
|
||||
if($this->options->imageBase64){
|
||||
$pdfData = $this->base64encode($pdfData, 'application/pdf');
|
||||
$pdfData = $this->toBase64DataURI($pdfData, 'application/pdf');
|
||||
}
|
||||
|
||||
return $pdfData;
|
||||
|
||||
@@ -131,7 +131,7 @@ class QRGdImage extends QROutputAbstract{
|
||||
}
|
||||
|
||||
if($this->options->imageBase64){
|
||||
$imageData = $this->base64encode($imageData, 'image/'.$this->options->outputType);
|
||||
$imageData = $this->toBase64DataURI($imageData, 'image/'.$this->options->outputType);
|
||||
}
|
||||
|
||||
restore_error_handler();
|
||||
|
||||
@@ -40,7 +40,7 @@ class QRMarkupSVG extends QRMarkup{
|
||||
|
||||
// transform to data URI only when not saving to file
|
||||
if(!$saveToFile && $this->options->imageBase64){
|
||||
$svg = $this->base64encode($svg, 'image/svg+xml');
|
||||
$svg = $this->toBase64DataURI($svg, 'image/svg+xml');
|
||||
}
|
||||
|
||||
return $svg;
|
||||
|
||||
@@ -117,7 +117,7 @@ abstract class QROutputAbstract implements QROutputInterface{
|
||||
/**
|
||||
* Returns a base64 data URI for the given string and mime type
|
||||
*/
|
||||
protected function base64encode(string $data, string $mime):string{
|
||||
protected function toBase64DataURI(string $data, string $mime):string{
|
||||
return sprintf('data:%s;base64,%s', $mime, base64_encode($data));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user