Endroid\QrCode\QrCode::setExtension PHP 메소드

setExtension() 공개 메소드

Set image type for rendering via extension.
public setExtension ( string $extension ) : QrCode
$extension string Image extension
리턴 QrCode
    public function setExtension($extension)
    {
        if ($extension == 'jpg') {
            $this->setImageType('jpeg');
        } else {
            $this->setImageType($extension);
        }
        return $this;
    }

Usage Example

예제 #1
0
 /**
  * Creates a QR code.
  *
  * @param array $options
  *
  * @return QrCode
  */
 public function createQrCode(array $options = array())
 {
     $options = $this->optionsResolver->resolve($options);
     $qrCode = new QrCode();
     if (isset($options['text']) && !is_null($options['text'])) {
         $qrCode->setText($options['text']);
     }
     if (isset($options['size']) && !is_null($options['size'])) {
         $qrCode->setSize($options['size']);
     }
     if (isset($options['padding']) && !is_null($options['padding'])) {
         $qrCode->setPadding($options['padding']);
     }
     if (isset($options['extension']) && !is_null($options['extension'])) {
         $qrCode->setExtension($options['extension']);
     }
     if (isset($options['error_correction_level']) && !is_null($options['error_correction_level'])) {
         $qrCode->setErrorCorrection($options['error_correction_level']);
     }
     if (isset($options['foreground_color']) && !is_null($options['foreground_color'])) {
         $qrCode->setForegroundColor($options['foreground_color']);
     }
     if (isset($options['background_color']) && !is_null($options['background_color'])) {
         $qrCode->setBackgroundColor($options['background_color']);
     }
     if (isset($options['label']) && !is_null($options['label'])) {
         $qrCode->setLabel($options['label']);
     }
     if (isset($options['label_font_size']) && !is_null($options['label_font_size'])) {
         $qrCode->setLabelFontSize($options['label_font_size']);
     }
     if (isset($options['label_font_path']) && !is_null($options['label_font_path'])) {
         $qrCode->setLabelFontPath($options['label_font_path']);
     }
     return $qrCode;
 }
All Usage Examples Of Endroid\QrCode\QrCode::setExtension