Filling text with Gif Images
Posted: 2014-02-19T00:03:29-07:00
Hello People,
Below is my code .
above code works fine if we have fill with PNG OR JPEG IMAGES but if we have to use gif image then it does not output animated text.... As you can see i have used flame.gif is an animated image, output is not exactly the same of what iam looking for... how to fix this?
Below is my code .
Code: Select all
/* Create a new imagick object */
$im = new Imagick('C:\wamp\www\flame.gif');
/* Create new image. This will be used as fill pattern */
//$im->newPseudoImage(50, 50, "gradient:red-black");
/* Create imagickdraw object */
$draw = new ImagickDraw();
/* Start a new pattern called "gradient" */
$draw->pushPattern('gradient', 0, 0, 50, 50);
/* Composite the gradient on the pattern */
$draw->composite(Imagick::COMPOSITE_OVER, 0, 0, 50, 50, $im);
/* Close the pattern */
$draw->popPattern();
/* Use the pattern called "gradient" as the fill */
$draw->setFillPatternURL('#gradient');
/* Set font size to 52 */
$draw->setFontSize(52);
/* Annotate some text */
$draw->annotation(20, 50, "Hello World!");
/* Create a new canvas object and a white image */
$canvas = new Imagick();
$canvas->newImage(350, 70, "white");
/* Draw the ImagickDraw on to the canvas */
$canvas->drawImage($draw);
/* 1px black border around the image */
$canvas->borderImage('black', 1, 1);
/* Set the format to PNG */
$canvas->setImageFormat('gif');
/* Output the image */
header("Content-Type: image/gif");
echo $canvas;