Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.63 KB | None | 0 0
  1. <?php
  2. include ('mysql.php');
  3.  
  4.  
  5.  
  6. $vetrina_query=mysql_query("SELECT * FROM professionisti_pagina WHERE logo='' LIMIT 1");
  7. while($vetrina_row=mysql_fetch_array($vetrina_query))
  8. {
  9. $my_img = imagecreatetruecolor(200, 200);
  10. imagesavealpha($my_img, true);
  11. $color = imagecolorallocatealpha($my_img, 0, 0, 0, 127);
  12. imagefill($my_img, 0, 0, $color);
  13. $font='/var/www/vhosts/ns3000093.ovh.net/site1/img/loghi_gen_base/1.ttf';
  14. $text='mirko quotalo associazione';
  15. $text_box = imagettfbbox(10,0,$font,$text);
  16. $text_width = $text_box[2]-$text_box[0];
  17. $text_height = $text_box[7]-$text_box[1];
  18. $x = (200/2) - ($text_width/2);
  19. $y = (140) - ($text_height/2);
  20. $black = imagecolorallocate($my_img, 0, 0, 0);
  21. imagettftext($my_img, 10, 0, $x, $y, $black, $font, $text);
  22. imagettftext($my_img, 10, 0, $x, $y+20, $black, $font, $text);
  23. imagettftext($my_img, 10, 0, $x, $y+40, $black, $font, $text);
  24.  
  25.  
  26.  
  27.  
  28. imagepng( $my_img, '/var/www/vhosts/ns3000093.ovh.net/site1/img/loghi_gen_base/temp.png');
  29.  
  30.  
  31. // Create image instances
  32.     $src = imagecreatefromjpeg('/var/www/vhosts/ns3000093.ovh.net/site1/img/loghi_gen_base/0001.jpg');
  33.     $dest = imagecreatefrompng('/var/www/vhosts/ns3000093.ovh.net/site1/img/loghi_gen_base/temp.png');
  34.  
  35. // Copy
  36.     imagecopy($dest, $src, 42, 10, 0, 0, 115, 115);
  37.  
  38. // Output and free from memory
  39.     imagepng($dest,'/var/www/vhosts/ns3000093.ovh.net/site1/img/loghi_gen_base/merged.png');
  40.  
  41.  
  42.  
  43.  
  44. /*$my_img = imagecreate( 200, 200 );
  45. $background = imagecolorallocate( $my_img, 255, 255, 255 );
  46. imagejpeg( $my_img,'/var/www/vhosts/ns3000093.ovh.net/site1/img/loghi_gen_base/merged.jpg' );
  47. imagedestroy( $my_img );*/
  48.  
  49. }
  50. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement