GuvenlikdKodu Class - Resim yapalim


/ Published in: PHP
Save to your folder(s)

Written by Zafer Korucu


Copy this code and paste it in your HTML
  1. <?php
  2. //guvenlik_resmi.php
  3.  
  4. //Tarayıcımıza oluşturduğumuz verinin resim( gif )olduğunu belirtiyoruz
  5. header ('Content-type: image/gif');
  6.  
  7. //Session'a atadigimiz kodumuzu alalim
  8. $Kod = $_SESSION ['guvenlikkodu'];
  9.  
  10. //Resmimiz için bir artalan ve font sekli
  11. $resim = "security.gif";
  12. $font = "trash.TTF";
  13. $resimYap = imagecreatefromgif ( $resim );
  14.  
  15. // Yazi ve arka plan renklerini belirleyelim
  16. //Arkadaki gri kod
  17. $gri = imagecolorallocate ( $resimYap, 170, 170, 170 );
  18. //Asil kod
  19. $siyah = imagecolorallocate ( $resimYap, 0, 0, 0 );
  20.  
  21. //Artalan resmimizin üstüne kodumuzu yazalım
  22. imagettftext ( $resimYap, 30, 10, 29, 39, $gri, $font, $Kod );
  23. imagettftext ( $resimYap, 20, 6, 8, 35, $siyah, $font, $Kod );
  24.  
  25. //Son islem olarak resim yap
  26. imagegif ( $resimYap );
  27. //önbellegi temizle
  28. imagedestroy ( $resimYap );
  29. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.