PHP GD Library watermark wrapping cannot display function text

Source: Internet
Author: User
Some of the code found on the web is pieced together. But the final step does not show the total is not their 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,0,35,160, $black, $fontname, $STR);  Header (' Content-type:image/jpeg ');  Imagejpeg ($im);  Imagedestroy ($im); }?>


How do you change the words that return an array of characters to a parameter that STR passes over? Thank you, great God.


Reply to discussion (solution)

Can you put your last word "how do I change the number of words that return an array of characters to a parameter that str passes over?" "Write an example to post it, and the last step of the code above you is referring to this?" Imagettftext ($im, $font _size,0,35,160, $black, $fontname, $STR);

Can you put your last word "how do I change the number of words that return an array of characters to a parameter that str passes over?" "Write an example to post it, and the last step of the code above you is referring to this?" Imagettftext ($im, $font _size,0,35,160, $black, $fontname, $STR);



I want to replace the "return an array of characters" with the function that I passed.
is the ability to implement text wrap ... Because it is small white can only copy a piece of code to modify
Himself put: $str = AutoWrap (12,0, ' 33.ttf ', ' returns an array of characters ', 250); This paragraph is changed to $str = AutoWrap (12,0, ' 33.ttf ', ' $_get[' str '] ', 250);
After such a direct cannot receive, do not know is the question of grammar or what problem, remove the quotation marks and become empty ... Do not know where the problem is, so to solve

The simple point is:? str=, how are you, hello, how you doin ', How you doin ', How you doin '? After the 78th word, the watermark is automatically wrapped in the picture

I changed it, defined a new function has been done, 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: [email protected] 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.