<?php require_once realpath(dirname(__FILE__)) . '/../require.php'; $qrcode = new Image_QRCode(array("path" => DATA_REALDIR . "module/Image/data", "image_path" => DATA_REALDIR . "module/Image/imagedata")); $objProduct = new SC_Product_Ex(); if ($objProduct->isValidProductId($_GET["product_id"], true)) { $sid = $_GET["sid"]; $p_detail_url = HTTP_URL . substr(P_DETAIL_URLPATH, strlen(ROOT_URLPATH)); $p_detail_url = str_replace("detail.php", "detail_spass.php", $p_detail_url); $qrcode->makeCode($p_detail_url . $_GET["product_id"] . "&admin=on&sid={$sid}", array('image_type' => 'jpeg', 'error_correct' => 'L')); }
$encurtador = new Encurtador(); $encurtador->setUrl($_POST['url']); $recurso = $encurtador->getRecurso(); $recurso->salvar(); header('Location: ' . APPLICATION_URL . $recurso->getShorten() . '+'); }); $mini->get('/{hash}+', function ($shorten) { $recurso = new \Mini\Recurso(); $recurso->setShorten($shorten); $recurso->buscar(); $acessos = $recurso->getAcessos(); include '../app/view/shorten.php'; }); $mini->get('/{hash}/{hash2}', function ($hash, $hash2) { echo $hash, $hash2; }); $mini->get('/{hash}', function ($shorten) { $recurso = new \Mini\Recurso(); $recurso->setShorten($shorten); $recurso->buscar(); $origem = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null; $recurso->addAcesso($origem); header('Location: ' . $recurso->getUrl()); }); $mini->get('/{hash}.qrcode', function ($shorten) { require_once 'Image/QRCode.php'; header('Content-Type = image/png'); $qrcode = new \Image_QRCode(); $im = $qrcode->makeCode(APPLICATION_URL . $shorten, array('image_type' => 'png')); }); $mini->run($url);
/** * testSetInvalidDataPath() * * @expectedException Image_QRCode_Exception * @return void */ public function testSetInvalidDataPath() { $arr = array("path" => "."); $testObj = new Image_QRCode($arr); $testObj->makeCode("Hello, world"); }
<?php $qrcode = new Image_QRCode(array("path" => DATA_REALDIR . "module/Image/data", "image_path" => DATA_REALDIR . "module/Image/imagedata")); $qrcode->makeCode(HTTP_URL, array('image_type' => 'jpeg', 'error_correct' => 'L', 'module_size' => 64));
static function CreateQRBarcode($encodetext, $id = null, $imageType = "png") { $qrbacode = new Image_QRCode(); $option = array("image_type" => $imageType, "output_type" => "return"); $image = $qrbacode->makeCode($encodetext, $option); $filename = $id; if ($id == null) { $filename = sha1(addslashes($encodetext)); } $filename = BARCODE_PATH . $filename . ".png"; $bool = imagepng($image, $filename); if ($bool) { return $filename; } return null; }