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;
}