1--TEST-- 2Test ImagickDraw, setTextAlignment 3--SKIPIF-- 4<?php 5$imageMagickRequiredVersion=0x675; 6require_once(dirname(__FILE__) . '/skipif.inc'); 7?> 8--FILE-- 9<?php 10 11require_once(dirname(__FILE__) . '/functions.inc'); 12 13$backgroundColor = 'rgb(225, 225, 225)'; 14$strokeColor = 'rgb(0, 0, 0)'; 15$fillColor = 'DodgerBlue2'; 16 17function setTextAlignment($strokeColor, $fillColor, $backgroundColor) { 18 $draw = new \ImagickDraw(); 19 setFontForImagickDraw($draw); 20 $draw->setStrokeColor($strokeColor); 21 $draw->setFillColor($fillColor); 22 $draw->setStrokeWidth(1); 23 $draw->setFontSize(36); 24 25 $draw->setTextAlignment(\Imagick::ALIGN_LEFT); 26 $draw->annotation(250, 75, "Lorem Ipsum!"); 27 $draw->setTextAlignment(\Imagick::ALIGN_CENTER); 28 $draw->annotation(250, 150, "Lorem Ipsum!"); 29 $draw->setTextAlignment(\Imagick::ALIGN_RIGHT); 30 $draw->annotation(250, 225, "Lorem Ipsum!"); 31 $draw->line(250, 0, 250, 500); 32 33 $imagick = new \Imagick(); 34 $imagick->newImage(500, 500, $backgroundColor); 35 $imagick->setImageFormat("png"); 36 $imagick->drawImage($draw); 37 38 $bytes = $imagick->getImageBlob(); 39 if (strlen($bytes) <= 0) { echo "Failed to generate image.";} 40} 41 42setTextAlignment($strokeColor, $fillColor, $backgroundColor) ; 43echo "Ok"; 44?> 45--EXPECTF-- 46Ok