Endroid\QrCode\QrCode::save PHP Method

save() public method

Render the QR Code then save it to given file name.
public save ( string $filename ) : QrCode
$filename string File name of the QR Code
return QrCode
    public function save($filename)
    {
        $this->render($filename);
        return $this;
    }

Usage Example

コード例 #1
0
 protected function createQrCode(MediaInterface $media)
 {
     $path = tempnam(sys_get_temp_dir(), 'sonata_media_qrcode_reference') . '.' . $this->config['extension'];
     $qrCode = new QrCode();
     $qrCode->setText($media->getBinaryContent())->setSize($this->config['size'])->setPadding($this->config['padding'])->setErrorCorrection($this->config['error_correction'])->setForegroundColor($this->config['foreground'])->setBackgroundColor($this->config['background'])->setLabel($this->config['label'])->setLabelFontSize($this->config['label_size'])->setImageType($this->config['extension']);
     if ($this->config['logo'] && is_file($this->config['logo'])) {
         $qrCode->setLogo($this->config['logo']);
     }
     $qrCode->save($path);
     return $path;
 }
All Usage Examples Of Endroid\QrCode\QrCode::save