The automatic line feed of the PHPGD Library watermark cannot display the code that function text finds on the Internet. But the last step does not show its own text content. the code is as follows:
$ V) {$ w = charwidth ($ fontsize, $ fontangle, $ ttfpath, $ v); $ _ width + = intval ($ w ); if ($ _ width> $ width) & ($ v! = "") {$ _ String. = "\ n"; $ _ width = 0;} $ _ string. = $ v; $ w = 0; // echo $ v;} $ _ string = mb_convert_encoding ($ _ string, "html-entities", "gbk "); return $ _ string;} $ str = autowrap (12, 0, '33. ttf', 'returns an array of characters ', 250); imagettftext ($ im, $ font_size, 160, $ black, $ fontname, $ str ); header ('content-type: image/jpeg '); imagejpeg ($ im); imagedestroy ($ im) ;}?>
How can we replace the returned character array with the parameters passed by str? Thank you!
Reply to discussion (solution)
Can you replace the last sentence "how to replace the returned character array with the parameters passed by str ?" Write an example and paste it out. what is the last step of your code above? Imagettftext ($ im, $ font_size, 0, 35, 160, $ black, $ fontname, $ str );
Can you replace the last sentence "how to replace the returned character array with the parameters passed by str ?" Write an example and paste it out. what is the last step of your code above? Imagettftext ($ im, $ font_size, 0, 35, 160, $ black, $ fontname, $ str );
I want to replace the section "returns an array of characters" with the function passed by myself.
Is to achieve the function of automatic text wrapping... Because it is a small white, you can only copy a piece of code to modify it.
Run $ str = autowrap (, '33. ttf', 'returns an array of characters ', 250); this section is changed to $ str = autowrap (, '33. ttf', '$ _ GET ['str']', 250 );
In this way, you can't receive it directly. you don't know whether the syntax is correct or what the problem is. removing the quotation marks becomes empty... I don't know what went wrong, so I can solve it.
The simple point is :? Str = after the seventh or eighth character, the watermark is automatically wrapped in the image.
I changed it myself and defined a new function. thank you!