Merhaba,
öncelikle githubdan https://github.com/t0k4rt/phpqrcode gerekli dosyaları indiriyoruz veya kuruyoruz
daha sonrasında qrlib.php adlı dosyayı çalışacağımız alana dahil etmemiz gerekiyor. hiç uğraşmadan projeye dahil olarak verdiği örneği direk function içerisine alıp, 4 adet otomatik qr kod oluşturdum. sonuç olarakta kullanıcının kendine ait sayfaları için kayıt esnasından sonra bir kere bu functionun çalışması ile profiline bak bunlar senin qr kodların diyebileceğiz
kullanım rehberine ve örneklere buradan ulaşabilirsiniz http://phpqrcode.sourceforge.net/
öncelikle githubdan https://github.com/t0k4rt/phpqrcode gerekli dosyaları indiriyoruz veya kuruyoruz
daha sonrasında qrlib.php adlı dosyayı çalışacağımız alana dahil etmemiz gerekiyor. hiç uğraşmadan projeye dahil olarak verdiği örneği direk function içerisine alıp, 4 adet otomatik qr kod oluşturdum. sonuç olarakta kullanıcının kendine ait sayfaları için kayıt esnasından sonra bir kere bu functionun çalışması ile profiline bak bunlar senin qr kodların diyebileceğiz
PHP:
function test() {
define( 'DIZIN_YOLU', dirname( __FILE__ ).'/testler/' );
$kullanici = 'kullanici';
$tur = array(
'profil@',
'iletisim@',
'hakkinda@',
'yorumlar@' );
$url = array(
'https://localhost/tr/profil/'.$kullanici,
'https://localhost/tr/hakkinda/'.$kullanici,
'https://localhost/tr/iletisim/'.$kullanici,
'https://localhost/tr/yorumlar/'.$kullanici
$i = 0;
$i2 = 0;
while( $i <4 ) {
$codeContents = $url[$i++];
$fileName = $tur[$i2++].$kullanici.'.png';
$outerFrame = 4;
$pixelPerPoint = 5;
$jpegQuality = 95;
// generating frame
$frame = QRcode::text( $codeContents, false, QR_ECLEVEL_M );
// rendering frame with GD2 ( that should be function by real impl.!!! )
$h = count( $frame );
$w = strlen( $frame[0] );
$imgW = $w + 2*$outerFrame;
$imgH = $h + 2*$outerFrame;
$base_image = imagecreate( $imgW, $imgH );
$col[0] = imagecolorallocate( $base_image, 255, 255, 255 );
// BG, white
$col[1] = imagecolorallocate( $base_image, 102, 16, 242 );
// FG, blue
imagefill( $base_image, 0, 0, $col[0] );
for ( $y = 0; $y<$h; $y++ ) {
for ( $x = 0; $x<$w; $x++ ) {
if ( $frame[$y][$x] == '1' ) {
imagesetpixel( $base_image, $x+$outerFrame, $y+$outerFrame, $col[1] );
}
}
}
// saving to file
$target_image = imagecreate( $imgW * $pixelPerPoint, $imgH * $pixelPerPoint );
imagecopyresized(
$target_image,
$base_image,
0, 0, 0, 0,
$imgW * $pixelPerPoint, $imgH * $pixelPerPoint, $imgW, $imgH
);
imagedestroy( $base_image );
imagejpeg( $target_image, DIZIN_YOLU.$fileName, $jpegQuality );
imagedestroy( $target_image );
}
}
test();


