1--TEST-- 2Test Tutorial, gradientReflection 3--SKIPIF-- 4<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?> 5--FILE-- 6<?php 7 8 9function gradientReflection() { 10 $im = new \Imagick(); 11 $im->newPseudoImage(640, 480, "magick:logo"); 12 13 $reflection = clone $im; 14 15 $reflection->flipImage(); 16 17 $reflection->cropImage($im->getImageWidth(), $im->getImageHeight() * 0.75, 0, 0); 18 19 $gradient = new \Imagick(); 20 $gradient->newPseudoImage( 21 $reflection->getImageWidth(), 22 $reflection->getImageHeight(), 23 //Putting spaces in the rgba string is bad 24 'gradient:rgba(255,0,255,0.6)-rgba(255,255,0,0.99)' 25 ); 26 27 $reflection->compositeimage( 28 $gradient, 29 \Imagick::COMPOSITE_DSTOUT, 30 0, 0 31 ); 32 33 $canvas = new \Imagick(); 34 $canvas->newImage($im->getImageWidth(), $im->getImageHeight() * 1.75, new \ImagickPixel('rgba(255, 255, 255, 0)')); 35 $canvas->compositeImage($im, \Imagick::COMPOSITE_BLEND, 0, 0); 36 $canvas->setImageFormat('png'); 37 $canvas->compositeImage($reflection, \Imagick::COMPOSITE_BLEND, 0, $im->getImageHeight()); 38 39 $canvas->stripImage(); 40 $canvas->setImageFormat('png'); 41 header('Content-Type: image/png'); 42 $bytes = $canvas; 43 if (strlen($bytes) <= 0) { echo "Failed to generate image.";} 44} 45 46gradientReflection() ; 47echo "Ok"; 48?> 49--EXPECTF-- 50Ok