Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ini_set('display_errors',1);
- ini_set('display_startup_errors',1);
- error_reporting(-1);
- define('WIDTH',1028);
- define('HEIGHT',614);
- define('ROWS',4);
- define('COLS',2);
- $templates = array(
- 'u' => new Imagick('templates/u.tif')
- );
- $image = new Imagick('templates/bg.tif');
- $image->scaleImage(COLS*WIDTH, ROWS*HEIGHT);
- $names = file('list.txt');
- $index = 0;
- $text = new ImagickDraw();
- $text->setFont("opensans.ttf");
- $text->setTextAlignment(Imagick::ALIGN_CENTER);
- $text->setFontSize(60);
- $text->setFillColor(new ImagickPixel('#ffffff'));
- $text->setStrokeAntialias(true);
- $text->setTextAntialias(true);
- while(($name = array_shift($names))!==NULL){
- $image->compositeImage($templates['u'], Imagick::COMPOSITE_DEFAULT, ($index % COLS)*WIDTH, floor($index / COLS)*HEIGHT);
- $image->annotateImage( $text , ($index % COLS)*WIDTH + WIDTH/2, floor($index / COLS)*HEIGHT + HEIGHT/2 , 0 , $name );
- $index++;
- if($index==8) break;
- }
- $image->flattenImages();
- $image->writeImage('images/output2.jpg');
- ?>
- <img src="images/output2.jpg">
Advertisement
Add Comment
Please, Sign In to add comment