A Imagettftext function contains the following parameters, Imagettftext (Image,size,angle, x, y,color,fontfile,text) means Imagettftext () to draw the string text to Images represented by the image, starting from the coordinate x,y (0, 0) in the upper-left corner, the angle is angle, the color is colored, and the TrueType font files specified by Fontfile are used.
Depending on the GD library used by PHP, if Fontfile does not start with '/', then '. TTF ' will be added to the filename and the library will be searched for the font path.
The coordinates represented by X,y define the basic point of the first character (presumably the lower-left corner of the character). This differs from imagestring (), whose x,y defines the upper-right corner of the first character.
Angle at 0 degrees reads the text from left to right (3 o'clock), and a higher value indicates a counterclockwise direction (that is, if the value is 90, the text is read from the bottom up).
Fontfile is the file name of the TrueType font you want to use.
Text is a literal string that can contain a sequence of UTF-8 characters (in the form: {) to access more than the first 255 characters in the font.
The color is the index value of the colour. Use a negative value with a color index to have the effect of turning off the anti-process color
For example, the following img.php source code, the application can be used for
The following are the referenced contents: ====================img.php
<?php Header ("Content-type:image/png"); /* Notification browser, to output the image * *
$im = Imagecreate (400, 300); /* If you do not specify an image, you can customize the size of the image * *
$im = Imagecreatefromjpeg ("gd04.jpg");
$pink = imagecolorallocate ($im, 0, 0, 0);
$fontfile = "C:\WINDOWS\Fonts\ founder static Bud TTF"; /* $fontfile The path of the font, depending on the operating system, can be Simhei.ttf (bold), Simkai. TTF (italics), Simfang. TTF (imitation), SimSun. TTC (XXFarEastFont-Arial & neo-Arial) and other GD-supported Chinese fonts * *
$str = Iconv (' GB2312 ', ' UTF-8 ', ' you want the character Watermark '); /* Convert gb2312 Character set to UTF-8 character * *
Imagettftext ($im, 25,10,140,240, $pink, $fontfile, $STR); /* Add Chinese Watermark * *
Imagepng ($im); Imagedestroy ($im); ?>
|
If a watermark for a dynamic URL is required, the
$str = Iconv (' GB2312 ', ' UTF-8 ', ' you want the character Watermark ');
Replace with
$str = Iconv (' GB2312 ', ' UTF-8 ', $_request["id"]);
Can