PHP Add background Tile watermark code to Picture _php tutorial

Source: Internet
Author: User
If you want to use PHP to add background tile watermark effect to the image, you must use a PHP plug-in to the instance, that is, using Imagick, he can add background tile watermark Effect Oh, below we provide an example code.

If you want to use PHP tutorial to add background tile watermark effect to the picture, you must use a PHP plugin to instance, that is, using Imagick, he can add background tile watermark effect Oh, below we provide an example code.


Imagemagic official removal of the command line mode of the picture background:

convert-size 140x80 xc:none-fill grey-gravity northwest-draw "text 10,10 ' copyright '"-gravity southeast-draw " Text 5,15 ' copyright ' "miff:-| Composite-tile-logo.jpg wmark_text_tiled.jpg


Imagick Code:

$image = new Imagick (' logo.jpg ');
$im = new Imagick ();
$im->newimage ("None") (Imagickpixel, new);
$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 been installed Php_imagick download it, download the address as follows

Http://pecl.php.net/package/imagick

http://www.bkjia.com/PHPjc/633008.html www.bkjia.com true http://www.bkjia.com/PHPjc/633008.html techarticle If you want to use PHP to add background tile watermark effect to the picture, you must use a PHP plug-in to the instance, that is, using Imagick, he can give the picture to add the background tile watermark effect Oh ...

  • Related Article

    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.