setLogoSize() public method

Set logo size in QR Code(default 48).
public setLogoSize ( integer $logo_size ) : QrCode
$logo_size integer Logo Size
return QrCode
Example #1
0
 /**
  * Add qr code
  *
  * @param string $text
  * @param array $options
  * @return PrintContent
  * @throws \Endroid\QrCode\Exceptions\DataDoesntExistsException
  * @throws \Endroid\QrCode\Exceptions\ImageFunctionFailedException
  * @throws \Endroid\QrCode\Exceptions\ImageFunctionUnknownException
  */
 public function addQrCode($text, array $options = [])
 {
     $options = array_merge(['size' => null, 'padding' => null, 'logo' => null, 'logo_size' => null], $options);
     $qrCode = new QrCode();
     $qrCode->setText($text);
     if (is_numeric($options['size'])) {
         $qrCode->setSize($options['size']);
     }
     if (is_numeric($options['padding'])) {
         $qrCode->setPadding($options['padding']);
     }
     if ($options['logo'] && file_exists($options['logo'])) {
         $qrCode->setLogo($options['logo']);
         if (is_numeric($options['logo_size'])) {
             $qrCode->setLogoSize($options['logo_size']);
         }
     }
     return $this->addPhoto($qrCode->get('jpg'));
 }