Home > Backend Development > PHP Tutorial > PHP gif image watermark code_PHP tutorial

PHP gif image watermark code_PHP tutorial

WBOY
Release: 2016-07-13 10:45:29
Original
939 people have browsed it

The php gd library cannot add watermarks to gif images. If you want to use php to add watermarks to gif images, you have to use a PHP extension with ImageMagick function, which can help us complete the functions we want. .

PHP tutorial gd library cannot add watermarks to gif images. If you want to use php to add watermarks to gif images, you have to use a php extension with imagemagick function, which can help us complete the functions we want. oh.

$imagedraw = new imagick();
$pixel = new imagickpixel('gray');
$pixel->setcolor('black');
$imagedraw->newimage(100, 75, $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, 12, 0, 'copyright by mpeg');
$animation->addimage($thisimage);
$animation->setimagedelay($delay);
}       
header("content-type: image/gif");
echo $animation->getimagesblob();
?>

PHP extension 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. . Using imagemagick, you can dynamically generate images according to the needs of web applications. You can also change the size, rotate, sharpen, reduce color or add special effects to an image (or a group of images), and save the results in the same format. or save in other formats.

Component download address

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

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/633009.htmlTechArticlephp gd library cannot add watermarks to gif images. If you want to use php to add watermarks to gif images, We have to use a PHP extension with ImageMagick function, which can help us accomplish what we want...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template