Add text and image watermarks to images, and add text watermarks to images. Add text and image watermarks to images, and add text watermarks to images? Php *** @ desc image processing class * classPic {private $ info; private $ res; public $ thumb_pic; publicfunct image adding text watermark and image watermark, adding text watermark image
Info = getimagesize ($ picPath); // Obtain the image name $ this-> info ['type'] = image_type_to_extension ($ this-> info [2], false ); $ funs = 'imagecreatefrom '. $ this-> info ['type']; $ this-> res = $ funs ($ picPath);} // Thumbnail public function thumb ($ w = 100, $ h = 100) {// create an image resource $ image_thumb = imagecreatetruecolor ($ w, $ h); imagecopyresampled ($ image_thumb, $ this-> res, $ w, $ h, $ this-> info [0], $ this-> info [1]); imagedestroy ($ this-> res ); $ this-> res = $ image_thumb;} // Display public function showPic () {header ('content-type :'. $ this-> info ['type']); $ funs = 'image '. $ this-> info ['type']; $ funs ($ this-> res);} // save the public function savePic ($ newname) {$ funs = 'image '. $ this-> info ['type']; $ funs ($ this-> res, $ newname. ". ". $ this-> info ['type']);} // destroy the image public function _ destruct () {imagedestroy ($ this-> res );} /*** @ desc add a text watermark * @ param $ content string text * @ param $ fonturl string font path * @ param $ fontsize int font size * @ param $ fontcolor array set color and transparency * @ param $ local array watermark coordinate * @ param $ fontangle int font rotation angle */public function fontMark ($ content, $ fonturl, $ fontsize, $ fontcolor, $ local, $ fontangle) {$ color = imagecolorallocatealpha ($ this-> res, $ fontcolor [0], $ fontcolor [1], $ fontcolor [2], $ fontcolor [3]); imagettftext ($ this-> res, $ fontsize, $ fontangel, $ local ['x'], $ local ['Y'], $ color, $ fonturl, $ content );} /*** @ desc add an image watermark * @ param $ markPic string watermark image * @ param $ local array image coordinate * @ param $ alpha array set color and transparency */public function picMark ($ markPic, $ local, $ alpha) {$ markInfo = getimagesize ($ markPic); $ markType = image_type_to_extension ($ markInfo [2], false); $ markFun = 'imagecreatefrom '. $ markType; $ markWater = $ markFun ($ markPic); imagecopymerge ($ this-> res, $ markWater, $ local ['x'], $ local ['Y'], 0, 0, $ markInfo [0], $ markInfo [1], $ alpha); imagedestroy ($ markWater) ;}}$ pic = new Pic('yibo_pic28.jpg '); $ pic-> picMark('logo3.png ', array ('x' => 50, 'y' => 50), 30); $ pic-> showPic ();
Watermark and image watermark, add text watermark image? Php/*** @ desc image processing class */class Pic {private $ info; private $ res; public $ thumb_pic; public funct...