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.
<?
/*** a new Imagick object ***/
$aniGif = new Imagick();
/*** set the image format to gif ***/
$aniGif->setFormat( "gif" );
/*** a new ImagickPixel object for the colors ***/
$color = new ImagickPixel( "white" );
/*** set color to white ***/
$color->setColor( "white" );
/*** the text for the image ***/
$string = "write what ever";
/*** a new draw object ***/
$draw = new ImagickDraw();
/*** set the draw font to helvetica ***/
$draw->setFont( "arial.ttf" );
/*** loop over the text ***/
for ( $i = 0; $i <= strlen( $string ); $i++ )
{
/*** grab a character ***/
$part = substr( $string, 0, $i );
/*** create a new gif frame ***/
$aniGif->newImage( 100, 50, $color );
/*** add the character to the image ***/
$aniGif->annotateImage( $draw, 10, 10, 0, $part );
/*** set the frame delay to 30 ***/
$aniGif->setImageDelay( 30 );
}
/*** write the file ***/
$aniGif->writeImages('ani.gif', $out);
?>
it is not creating "ani.gif" but it is creating list of images from "ani-0.gif" to "ani-9.gif" ....yes looks very simple... but still not working??? can any one fix this??? waiting for your response asap..
writeImages() has two parameters. The first is the file name, the second determines if you get a multi-file out put like you got or a single file like you want. The second perimeter is Boolean. If TRUE then multi; if FALSE then single file. In your script the second perimeter is $out and since you don't give it a value it is FALSE. Set it to FALSE and you'll get the single file:
<?
/*** a new Imagick object ***/
$aniGif = new Imagick();
/*** set the image format to gif ***/
$aniGif->setFormat( "gif" );
/*** a new ImagickPixel object for the colors ***/
$color = new ImagickPixel( "white" );
/*** set color to white ***/
$color->setColor( "white" );
/*** the text for the image ***/
$string = "write what ever";
/*** a new draw object ***/
$draw = new ImagickDraw();
/*** set the draw font to helvetica ***/
$draw->setFont( "Arial.TTF" );
/*** loop over the text ***/
for ( $i = 0; $i <= strlen( $string ); $i++ )
{
/*** grab a character ***/
$part = substr( $string, 0, $i );
/*** create a new gif frame ***/
$aniGif->newImage( 100, 50, $color );
/*** add the character to the image ***/
$aniGif->annotateImage( $draw, 10, 10, 0, $part );
/*** set the frame delay to 30 ***/
$aniGif->setImageDelay( 30 );
}
/*** write the file ***/
$aniGif->writeImages('ani.gif', TRUE);
header("Location:ani.gif");
?>