To jest stara wersja strony!
Prosty skrypt w PHP wykorzystujący bibliotekę phpqrcode do generowania kodów QR
Link do programu:
https://wiki.ostrowski.net.pl/qrcode/
Kod rozwiązania:
<?php require_once './phpqrcode/qrlib.php'; // include the QR library header('Cache-Control: no-cache, must-revalidate'); // Disable caching header('Expires: 0'); // Set expiration to 0 header('Pragma: no-cache'); // Disable cache for older browsers ?> <!DOCTYPE html> <html> <head> <title>Simple QR Code Generator</title> </head> <body> <h2>QR Code Generator</h2> <form method="post"> Enter text or URL: <input type="text" name="text" required> <button type="submit">Generate QR Code</button> </form> <?php if (!empty($_POST['text'])) { $text = $_POST['text']; $filename = 'qrcode.png'; // Dynamically adjust the size based on the length of the input text $dataLength = strlen($text); $size = 5; // Default size if ($dataLength <= 50) { $size = 5; // Small amount of data } elseif ($dataLength <= 100) { $size = 6; // Medium amount of data } elseif ($dataLength <= 200) { $size = 7; // Larger data } elseif ($dataLength <= 300) { $size = 8; // Even larger data } else { $size = 9; // Very large data } // Create the QR code with the calculated size QRcode::png($text, $filename, QR_ECLEVEL_L, $size); echo "<h3>Your QR Code:</h3>"; echo "<img src='$filename'><br>"; echo "<a href='$filename' download>Download QR Code</a>"; } ?> </body> </html>