thinkphp Chinese watermark and Picture watermark Integrated plug-in

Source: Internet
Author: User

Today to share the Chinese watermark and picture watermark Integrated plug-in, thinkphp only separate add text or add pictures, because the need to work with the Riga "text" and "picture" so, try to modify a bit, only one line of code to solve the image and text watermark. First, the image method of thinkphp is introduced, and the Chinese watermark is supported.


1. Front-End Template: Front-end original picture and watermark image display contrast <p class= "notice Red" > Original: </p>
<p class= "notice Red" Style= "margin:10px 0" > After Chinese watermark: </p>
2, the main controller introduced thinkphp Watermark class


<?phpnamespace home\controller;use think\controller;header (" Content-type:text/html;charset=utf-8 ");class indexcontroller extends controller {     public function index ()  {        $ Image = new \think\image ();         $str  =  " Two-headed generation watermark picture Time:  " . date (" y-m-d h:i:s ")  . " ";          $image->open (' public/images/original.jpg ')->water (' Public/images/water_bg.png ')->text ($ str,  ' Public/images/simhei.ttf ', 14,  ' #FFFFFF ', \think\image::image_water_southeast,  -20)->save ("Public/images/new.jpg");         $this->display ();     }}?> 

please take away the children's shoes if necessary . Demo Address: http://www.erdangjiade.com/php/937.html

thinkphp Chinese watermark and Picture watermark Integrated plug-in

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.