public function getQrcode()
 {
     $sku = $this->getProduct()->getSku();
     $renderer = new \BaconQrCode\Renderer\Image\Png();
     $renderer->setHeight(256);
     $renderer->setWidth(256);
     $writer = new \BaconQrCode\Writer($renderer);
     $pngfileName = "pub/media/qrcode/" . $sku . ".png";
     $writer->writeFile($sku, $pngfileName);
 }
Exemplo n.º 2
0
 public function tfaRenderQrCodeAction()
 {
     $filePath = tempnam('data/tmp/', '2fa-qr-');
     $renderer = new \BaconQrCode\Renderer\Image\Png();
     $renderer->setForegroundColor(new \BaconQrCode\Renderer\Color\Rgb(170, 45, 76));
     $renderer->setHeight(256);
     $renderer->setWidth(256);
     $writer = new \BaconQrCode\Writer($renderer);
     $writer->writeFile('123456', $filePath);
     $response = new Stream();
     $response->setCleanup(true);
     $response->setStream(fopen($filePath, 'rb'));
     $response->setStreamName($filePath);
     $headers = $response->getHeaders();
     $headers->addHeaderLine('Content-Length', filesize($filePath));
     $headers->addHeaderLine('Content-Type', 'image/png');
     return $response;
 }
Exemplo n.º 3
0
 /**
  *  Get the QR code representing the asset
  *
  * @param  int  $assetId
  * @return View
  **/
 public function getQrCode($assetId = null)
 {
     $settings = Setting::getSettings();
     if ($settings->qr_code == '1') {
         $asset = Asset::find($assetId);
         if (isset($asset->id)) {
             $renderer = new \BaconQrCode\Renderer\Image\Png();
             $renderer->setWidth($this->qrCodeDimensions['height'])->setHeight($this->qrCodeDimensions['height']);
             $writer = new \BaconQrCode\Writer($renderer);
             $content = $writer->writeString(route('view/hardware', $asset->id));
             $content_disposition = sprintf('attachment;filename=qr_code_%s.png', preg_replace('/\\W/', '', $asset->asset_tag));
             $response = Response::make($content, 200);
             $response->header('Content-Type', 'image/png');
             $response->header('Content-Disposition', $content_disposition);
             return $response;
         }
     }
     $response = Response::make('', 404);
     return $response;
 }
Exemplo n.º 4
0
 public function write($toWrite, $qrPath)
 {
     $writer = new \BaconQrCode\Writer($this->renderer);
     $writer->writeFile($toWrite, $qrPath);
     return $this;
 }
Exemplo n.º 5
0
<?php

$renderer = new \BaconQrCode\Renderer\Image\Png();
$renderer->setHeight(400);
$renderer->setWidth(400);
$writer = new \BaconQrCode\Writer($renderer);
header('Content-Type: image/png');
print $writer->writeString($data);
exit;
Exemplo n.º 6
0
	<!-- /#sidebar-wrapper -->

	<!-- Page Content -->
	<div id="page-content-wrapper">
		<div class="container-fluid">
			<h1>Bitcoin Jukebox</h1>
			<h3>Step 1: Read QR code with your mobile phone.</h3>
			<h3>Step 2: Order songs you like.</h3>
			<h3>Step 3: Pay them with bitcoin.</h3>
			<img src="data:image/png;
			<?php 
$renderer = new \BaconQrCode\Renderer\Image\Png();
$renderer->setHeight(240);
$renderer->setWidth(240);
$renderer->setMargin(5);
$writer = new \BaconQrCode\Writer($renderer);
$isLocalhost = $_SERVER['SERVER_NAME'] == 'localhost' || \Nette\Utils\Strings::startsWith($_SERVER['SERVER_NAME'], '192.168');
$url = $isLocalhost ? getHostByName(getHostName()) . '/bitcoinJukebox/adminAndMobile' : 'http://jukebox.paralelnipolis.cz/';
echo "base64," . base64_encode($writer->writeString($url));
?>
			" class="qr-image" alt="QR code link to order page">
		</div>
	</div>
	<!-- /#page-content-wrapper -->

</div>
<!-- /#wrapper -->

<?php 
$connected = @fsockopen("www.google.com", 80) != false;
?>
Exemplo n.º 7
0
 /**
  * Generate the URL for the Google Charts API to make the QR code
  * To use in an image tag:
  *
  * '<img src="data:image/png;base64,'.base64_encode($data).'"/>
  *
  * @param string $holder Account identifier (email, username, etc)
  * @param string $name Name of the application
  * @param integer $size Height x Width in pixels of the resulting image
  */
 public function generateQrImage($holder, $name, $size = 30)
 {
     $data = 'otpauth://totp/' . $name . ':' . $holder . '?secret=' . $this->getInitKey();
     $renderer = new \BaconQrCode\Renderer\Image\Png();
     $renderer->setMargin(0)->setHeight($size)->setWidth($size);
     $writer = new \BaconQrCode\Writer($renderer);
     return $writer->writeString($data);
 }