Help displaying tick with imagestring();

Hiya, I currently have my script which outputs an image which is working great. But I would like a tick to be added to the end of it.

[php]imagestring($im, 3, 20, 3, $n, $text_color);[/php]

Which does everything it’s ment to, BUT I would like to have :heavy_check_mark: added to the end of $n.
I can’t copy and paste this in and when I put the HTML code to write it in there (:heavy_check_mark:) it just puts the text in there instead of the tick.

Anyway around this?
Cheers guys.

Not sure, but I think where you create the $n OR when you put it into the imagestring
you would do it something like this: $n . “&#10004” … Not sure, did not test it.
But, from a quick search and read, you just add it to the end of the string… Hope it work for you…

Thanks for your input.
Unfortunately I have tried and if $n=John
It outputs to image John &#10004
:frowning:

I solved it… Seems you can NOT do it the way you were trying it… Or, me too… LOL…

You have to use this combo… " + &radic" that is a checkmark in PHP!!!

SO, either where you create the $n or in the imagecreate , wherever, you just add the &radic to it…

Hope that helps…

Thanks, Ill test it out after work

Sorry man, isn’t working for me.

[php]$p=$n.’&radic’;
$text_color = imagecolorallocate($im, 150, 255, 150);
$this->CenterImageString($im, 120, $p, 3, 3, $text_color);[/php]

Outputs
(theirname)&radic

take the quotes out! just + &radic (Its a PHP char not text)

[php]$this->CenterImageString($im, 120, $n + &radic, 3, 3, $text_color);[/php]

Parse error: syntax error, unexpected ‘&’ in /home/a5086311/public_html/roster/system/funtions.class.php on line 43

I tried it all ways I could think of $n + &radic, $n . &radic, $n .’&radic’

Well, this is an interesting walk thru character encoding… It seems that the character encoding must use UTF-8 encoding which is really a multiple-byte encoding. It is not displayable in the normal way. I am not sure how this can be done. Since you want to use it in a graphics app, you could just create one as a graphic and then use PHP code to position it in the image wherever you want it. Here is a link that explains a lot of encoding. I doubt it will help, so I think the graphic way would be better.

http://www.php.net/manual/en/function.htmlspecialchars.php

This link talks about encoding UTF-8 multiple-byte characters. It shows how to put it into unicode versions.
Not sure if that helps either…

http://www.php.net/manual/en/function.htmlentities.php

It appears that html does not handle single characters the same way as MS Word or Windows. So, they have to be encoded in a very certain way. The checkmark appears to be one of these characters. Not sure where to send you next. I think just go with the graphic version… Sorry, and good luck…

Yeah I’ve looked through all that stuff at php.net with no luck. Shame it doesn’t just have an ascii number :-X

Yeah I thought along those lines aswell with positioning yet another image ontop of the create image and re-saving it.
Appreciate all your help on this

You are welcome… I am sorry I could not come up with a better answer… On the other end, I can help you with the image code if you need it. It is easy to locate the current letter in a pix and then merge a checkmark graphic just after it. Only thing you need to figure out is how big to make the checkmark graphic image… (Number of pixels high and across so they match the letter size…) If you can’t figure it out let us know…

Thanks but its sorted now.
Just put the tick at the very end of the image width. and middle for height.
Dunno why it was so hard to get it output as text char but o well.

Sponsor our Newsletter | Privacy Policy | Terms of Service