index.php 1.72 KB
<?php

/**
 * REQUIRE: 
 * * apt-get install php5-imagick
 * * .htaccess -> _htaccess
 * * Apache rewrite Modul
 * 
 * 
 */
require_once('basepath.inc.php');
require_once($__PATH_to_mcClasses . 'include.php');

if(array_key_exists('qrcode', $_POST) && $_POST['qrcode']) {
	$qrtxt = $_POST['qrcode'];

        $qrcode_size = $_POST['qrcode_size'];
        $margin = $_POST['qrcode_margin'];
        
        $tmp_qrfilepath = 'tmp/tmp_qrfile.png';
	QRcode::png($qrtxt, $tmp_qrfilepath , $level = QR_ECLEVEL_L, $size = 10, $margin, $saveandprint=false); 

        $qr_image = new Imagick($tmp_qrfilepath);
	$qr_image->scaleImage($qrcode_size,$qrcode_size); 
	header('Content-type: image/png');
        echo $qr_image;
} else {
?>
<form action="index.php" method="post">
    
      <table border="0" cellpadding="5" cellspacing="0" bgcolor="#E0E0E0">
    <tr>
      <td align="right">size:</td>
      <td><input name="qrcode_size" type="text" size="10" maxlength="10" value="600"></td>
    </tr>
    <tr>
      <td align="right">margin:</td>
      <td><input name="qrcode_margin" type="text" size="10" maxlength="10" value="2"></td>
    </tr>
    <tr>
      <td align="right" valign="top">text to qrcode:</td>
      <td><textarea name="qrcode" cols="50" rows="10"></textarea></td>
    </tr>
    <tr>
      <td align="right">Formular:</td>
      <td>
        <input type="submit" value=" Absenden ">
        <input type="reset" value=" Abbrechen">
      </td>
    </tr>
  </table>
</form>
<?
}


/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
//$image->thumbnailImage(100, 0);
// bild größe skalieren
//	$image->adaptiveResizeImage(1024,768);
//	$image->scaleImage(800,800); 
//	$qr_image->setSize(800,800); 
?>