Guest User

Untitled

a guest
Oct 10th, 2014
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. <?php
  2.  
  3. ini_set('display_errors',1);
  4. ini_set('display_startup_errors',1);
  5. error_reporting(-1);
  6.  
  7. define('WIDTH',1028);
  8. define('HEIGHT',614);
  9.  
  10. define('ROWS',4);
  11. define('COLS',2);
  12.  
  13. $templates = array(
  14. 'u' => new Imagick('templates/u.tif')
  15. );
  16.  
  17. $image = new Imagick('templates/bg.tif');
  18. $image->scaleImage(COLS*WIDTH, ROWS*HEIGHT);
  19.  
  20. $names = file('list.txt');
  21. $index = 0;
  22.  
  23. $text = new ImagickDraw();
  24. $text->setFont("opensans.ttf");
  25. $text->setTextAlignment(Imagick::ALIGN_CENTER);
  26. $text->setFontSize(60);
  27. $text->setFillColor(new ImagickPixel('#ffffff'));
  28. $text->setStrokeAntialias(true);
  29. $text->setTextAntialias(true);
  30.  
  31. while(($name = array_shift($names))!==NULL){
  32.  
  33. $image->compositeImage($templates['u'], Imagick::COMPOSITE_DEFAULT, ($index % COLS)*WIDTH, floor($index / COLS)*HEIGHT);
  34. $image->annotateImage( $text , ($index % COLS)*WIDTH + WIDTH/2, floor($index / COLS)*HEIGHT + HEIGHT/2 , 0 , $name );
  35.  
  36. $index++;
  37. if($index==8) break;
  38. }
  39.  
  40.  
  41. $image->flattenImages();
  42. $image->writeImage('images/output2.jpg');
  43.  
  44. ?>
  45. <img src="images/output2.jpg">
Advertisement
Add Comment
Please, Sign In to add comment