Php adds a text watermark and image watermark code to an image (13 ). Php adds text watermark and image watermark code to the image. this program calls C: \ WINDOWS \ Fonts \ SIMHEI when adding text watermark to the image. TTF font, you can customize the image when adding a watermark to the image. php adds a text watermark and image watermark code to the image. this program calls C when adding a text watermark to the image: \ WINDOWS \ Fonts \ SIMHEI. TTF font. you can customize the image when adding a watermark to the image.
Php Tutorial: add a text watermark and image watermark code to an image
This program calls the c: windowsfontssimhei. ttf font when adding text watermark to the image. you can customize the image when adding a watermark to the image.
$ Image-> wprint_img (); // executes the image watermark.
$ Image-> wprint_string (); // execute a text watermark
*/
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: windowsfontssimhei. 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;
}
}
1 2 3
Upload the C: \ WINDOWS \ Fonts \ SIMHEI. TTF font. you can customize the image when adding a watermark to the image...