


PHP adds background tile watermark code to images_PHP tutorial
Jul 13, 2016 am 10:45 AMIf you want to use PHP to add a background tiled watermark effect to an image, you must use a plug-in in PHP to give an example, that is, use imagick, which can add a background tiled watermark effect to an image. Below we provide an example code .
If you want to use the php tutorial to add the background tiled watermark effect to the image, you must use a plug-in in php to implement it, that is, use imagick, which can add the background tiled watermark to the image. EffectOh, we provide an example code below.
imagemagic official command line mode to remove image background:
convert -size 140x80 xc:none -fill gray -gravity northwest -draw "text 10,10 'copyright'" -gravity southeast -draw "text 5,15 'copyright'" - .jpg wmark_text_tiled.jpg
imagick code:
<?php
$image = new imagick('logo.jpg');
$im = new imagick();
$im->newimage( 140, 80, new imagickpixel( "none" ) );
$draw = new imagickdraw();
$draw->setfillcolor(new imagickpixel( "grey" ));
$draw->setgravity(imagick::gravity_northwest);
$draw->annotation(10,10 ,'copyright');
$draw->setgravity(imagick::gravity_southeast);
$draw->annotation(5,15 ,'copyright');
$im->drawimage( $draw);
$image = $image->textureimage($im);
$image->compositeimage($image,imagick::composite_copy,0,0);
header( "content-type: image/{$image->getimageformat()}" );
$image->writeimage('wmark_text_tiled.jpg');
$image->clear();
$image->destroy();
?>
If your model has not installed php_imagick, please download it. The download address is as follows
http://pecl.php.net/package/imagick

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian

How To Set Up Visual Studio Code (VS Code) for PHP Development
