You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
İnstalled QRCode via compoer and using following PHP code to generate, however getting following error:
Fatal error: Uncaught Error: Call to undefined method Endroid\QrCode\Builder\Builder::fromScratch() in /var/www/generate_qr.php:18 Stack trace: #0 {main} thrown in /var/www/generate_qr.php on line 18
Code:
<?php
require 'vendor/autoload.php';
use Endroid\QrCode\Builder\Builder;
use Endroid\QrCode\Encoding\Encoding;
use Endroid\QrCode\ErrorCorrectionLevel;
use Endroid\QrCode\RoundBlockSizeMode;
use Endroid\QrCode\Writer\PngWriter;
if (isset($_GET['id'])) {
$productId = trim($_GET['id']); // Ürün ID'sini al
// QR kod oluşturma
$result = Builder::create()
->writer(new PngWriter())
->writerOptions([])
->data($productId)
->encoding(new Encoding('ISO-8859-1')) // Maksimum uyumluluk için ISO-8859-1
->errorCorrectionLevel(new ErrorCorrectionLevel(ErrorCorrectionLevel::LOW))
->size(200) // QR kod boyutu (200 piksel)
->margin(10) // Kenar boşluğu (10 piksel)
->roundBlockSizeMode(new RoundBlockSizeMode(RoundBlockSizeMode::MARGIN))
->build();
// Tarayıcıya PNG çıktısı gönderme
header('Content-Type: image/png');
header('Content-Disposition: inline; filename="qr-' . $productId . '.png"');
echo $result->getString();
exit;
} else {
echo "ID not found!";
}
The text was updated successfully, but these errors were encountered:
Hello,
İnstalled QRCode via compoer and using following PHP code to generate, however getting following error:
Fatal error: Uncaught Error: Call to undefined method Endroid\QrCode\Builder\Builder::fromScratch() in /var/www/generate_qr.php:18 Stack trace: #0 {main} thrown in /var/www/generate_qr.php on line 18
Code:
The text was updated successfully, but these errors were encountered: