PHP gif image plus watermark Code _php tutorial

Source: Internet
Author: User
Tags imagemagick
PHP GD Library is not able to add watermarks to GIF images, if you want to use PHP to add watermark to GIF images, you have to rely on a imagemagick function of PHP extension, it can help us to complete the function we want oh.

PHP Tutorial GD Library is not able to add watermarks to GIF images, if you want to use PHP to add watermark to GIF images, you have to rely on a imagemagick function PHP extension, it can help us to complete the function we want oh.

!--? php
$imagedraw = new Imagick ();
$pixel = new Imagickpixel (' Gray ');
$pixel->setcolor (' black ');
$imagedraw->newimage ($pixel);
$draw = new Imagickdraw ();
$draw->setfont (' bookman-demiitalic ');
$draw->setfontsize (12);
$image =new Imagick ();
$animation = new Imagick ();
$animation->setformat ("gif");
$image->readimage ("Old.gif");
$unitl = $image->getimageindex ();
$image->writeimages (' Animation.gif ', false);
$delay = $image->getimagedelay ();
$filename = ' animation-';
for ($i =0; $i < $unitl; $i + +) {
$thisimage = new Imagick ();
$thisimage->readimage ($filename. $i. gif ');
$thisimage->annotateimage ($draw, 0, 0, ' Copyright by MPEG ');
$animation->addimage ($thisimage);
$animation->setimagedelay ($delay);
}
Header ("Content-type:image/gif");
Echo $animation->getimagesblob ();
?>

PHP extensions for ImageMagick functionality.   Using this extension allows PHP to have the same functionality as ImageMagick. ImageMagick is a powerful, stable and free toolset and development package that can be used to read, write, and process image files in more than 185 basic formats, including popular TIFF, JPEG, GIF, PNG, PDF, and PHOTOCD formats. With ImageMagick, you can dynamically generate images based on the needs of your Web application, and you can resize, rotate, sharpen, subtract, or add effects to a (or a group of) images and save the results of the operation in the same format or other format.

Component Download Address

Http://pecl.php.net/package/imagick
http://www.imagemagick.org

http://www.bkjia.com/PHPjc/633009.html www.bkjia.com true http://www.bkjia.com/PHPjc/633009.html techarticle PHP GD Library is not able to add watermarks to GIF images, if you want to use PHP to add watermarks to GIF images, you have to rely on a imagemagick function of PHP extension, it can help us to complete we want to ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.