Created
September 29, 2010 06:36
-
-
Save dervn/602370 to your computer and use it in GitHub Desktop.
使用imagick在动态GIF上打文字水印
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?PHP | |
/*使用imagick在动态GIF上打文字水印*/ | |
$draw = new ImagickDraw(); | |
$draw->setFont('simsun.ttc'); | |
$draw->setFontSize( 12 ); | |
$text = iconv('GB2312', 'UTF-8', '网易'); | |
$image=new Imagick(); | |
$animation = new Imagick(); | |
$animation->setFormat( "gif" ); | |
$image->readImage("52924.gif"); | |
$unitl = $image->getNumberImages(); | |
for ($i=0; $i<$unitl; $i++) { | |
$image->setImageIndex($i); | |
$thisimage = new Imagick(); | |
$thisimage->readImageBlob($image); | |
$delay = $thisimage->getImageDelay(); | |
$thisimage->annotateImage($draw, 0, 12, 0, $text); | |
$animation->addImage($thisimage); | |
$animation->setImageDelay( $delay ); | |
} | |
header( "Content-Type: image/gif" ); | |
echo $animation->getImagesBlob(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment