Function text cannot be displayed when the PHPGD Library watermark is automatically wrapped.

Source: Internet
Author: User
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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.