Filling text with Gif Images

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
sriducati
Posts: 28
Joined: 2011-11-28T08:11:59-07:00
Authentication code: 8675308

Filling text with Gif Images

Post by sriducati »

Hello People,

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;
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?
Post Reply