$ Image-> wprint_img (); // executes the image watermark.
$ Image-> wprint_string (); // execute a text watermark
*/
The code is as follows: |
Copy code |
Class editimage { Private $ imagefile; // image file Private $ smallimg; // watermark image Private $ string; // watermark text Private $ position; // storage location Private $ dst_x = 600; // the x coordinate of the original image watermark Private $ dst_y = 0; // the y coordinate of the original image watermark. Private $ str_x = 450; Private $ str_y = 200; Private $ font = "c: windows ontssimhei. ttf"; // watermark the font path of the original image Private $ imgej; // The variable after imagecolorallocate Function _ get ($ value ){ Return $ this-> $ value; } Function _ set ($ property, $ value ){ $ This-> $ property = $ value; } /** * Constructor initialization * * @ Param string $ imagefile the watermark file * @ Param string $ smallimg watermark file * @ Param string $ string watermark text * @ Param string $ position storage location * @ Param int $ dst_x watermark image x * @ Param int $ dst_y the watermark image y */ Function _ construct ($ imagefile, $ smallimg = '', $ string ='') {//, $ position = '', $ dst_x = 0, $ dst_y = 0 $ This-> imagefile = $ imagefile; $ This-> smallimg = $ smallimg; $ This-> string = $ string; $ This-> imgej = $ this-> imagecreatef ($ this-> imagefile ); } Function get_extname ($ file) {// get the file suffix If (file_exists ($ this-> imagefile )){ $ Img = getimagesize ($ file ); Switch ($ img [2]) { Case "1 ": Return "gif "; Case "2 ": Return "jpg "; Case "3 ": Return "png "; } } Else { Return false; } } |