thinkphp add text watermark images generated with the two-dimensional code of a program to promote small poster

Image new new = $ \ of Think \ Image ();
                $ BGM = '. / Public / haibao.png'; // background
                $ poster = "./ Public / poster / $ gid.jpg"; // the watermark position commodity
                $ IMG = the explode ( '/', $ List [ 'Image']);
                $ Goods = "/ mnt / Data / wwwroot / Bzl / the Uploads / {$ IMG [ '. 4']} / {$ IMG [ '. 5' ]} ";
                $ baocun =" ./ Public / thumbnail The / $ gid.jpg "; // product thumbnail position
                $ image-> open ($ goods) -> thumb (460, 460, \ Think \ Image :: IMAGE_THUMB_CENTER ) -> save ($ baocun) ; // product thumbnail
                // $ image-> open ($ bgm ) -> water ($ thumb, \ Think \ Image :: IMAGE_WATER_NORTH, 100) -> save ($ poster);
                $ image-> open ($ bgm) -> water ($ baocun, \ Think \ Image :: IMAGE_WATER_NORTH, 100) -> save ($ poster);// add the product to the background image watermarking
                $ qrcode = $ this-> shopqrcode ( $ _ GET [ 'uid']);
                the explode QR = $ ( '/', $ qrcode);
                // $ strripos QR = ($ qrcode, '/');
                $ End = End ($ QR);
                // $ qrcodeimg = "/ mnt / Data / wwwroot / Bzl / qrcode / Watermark / $ End ";
                //$qrcodeimg="/mnt/data/wwwroot/bzl/Qrcode/$uid.png"; // two-dimensional code
                $ qrcodeimg = "/ mnt / data / wwwroot / bzl / qrcode / $ End ";
                //$qrcodeimg="https://".$_SERVER[SERVER_NAME]."/Qrcode/$id".".png";// return to the two-dimensional code
                $ sulvtu =" ./ Public / thumbnail / code - $ gid.jpg "". "; // product thumbnail position
                $ image-> open ($ qrcodeimg) -> thumb (200, 200, \ Think \ Image :: IMAGE_THUMB_CENTER) -> save ( $ sulvtu); // product thumbnail
                $ code = "./Public/code/$gid.png "; // two-dimensional code watermark
                $ wz = array (130,535); // two-dimensional code watermark position
                $ image-> open ($ poster) -> water ($ sulvtu, $ wz, 100) -> save ($ code); // add to the two-dimensional code background watermark
                $ fonts = "./ msyh.ttf";
                $ img = ". ./ Public / img / $ type $ gid.jpg"; // final posters
                $ prceiwz = array (30,485); // price watermark position
                $ titlewz = array (20,510); // price watermark position
                $ res = $ image-> open ( $ code) -> text ($ list [ 'title'], $ fonts, 12, '# 000000', $ titlewz, 0,0) -> text ($ list [ 'price '], $ fonts, 14, ' # FF0000 ', $ prceiwz, 0,0) -> save ($ img);

Guess you like

Origin www.cnblogs.com/xiaoqiangjun/p/11246100.html