1--TEST-- 2Test Imagick, distortImage 3--SKIPIF-- 4<?php 5$imageMagickRequiredVersion=0x675; 6require_once(dirname(__FILE__) . '/skipif.inc'); 7checkFormatPresent('png'); 8?> 9--FILE-- 10<?php 11 12$distortion = 1; 13 14 //$imagick = new \Imagick(realpath($this->rsiControl->getImagePath())); 15 $imagick = new \Imagick(); 16 17 /* Create new checkerboard pattern */ 18 $imagick->newPseudoImage(100, 100, "pattern:checkerboard"); 19 20 /* Set the image format to png */ 21 $imagick->setImageFormat('png'); 22 23 /* Fill new visible areas with transparent */ 24 $imagick->setImageVirtualPixelMethod(\Imagick::VIRTUALPIXELMETHOD_TRANSPARENT); 25 26 /* Activate matte */ 27 $imagick->setImageMatte(true); 28 29 /* Control points for the distortion */ 30 $controlPoints = array( 10, 10, 31 10, 5, 32 33 10, $imagick->getImageHeight() - 20, 34 10, $imagick->getImageHeight() - 5, 35 36 $imagick->getImageWidth() - 10, 10, 37 $imagick->getImageWidth() - 10, 20, 38 39 $imagick->getImageWidth() - 10, $imagick->getImageHeight() - 10, 40 $imagick->getImageWidth() - 10, $imagick->getImageHeight() - 30); 41 42 /* Perform the distortion */ 43 $imagick->distortImage(\Imagick::DISTORTION_PERSPECTIVE, $controlPoints, true); 44 $bytes = $imagick->getImageBlob(); 45 if (strlen($bytes) <= 0) { echo "Failed to generate image.";} 46 47echo "Ok"; 48?> 49--EXPECTF-- 50Ok