Rainbows!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

eye_onme
Forum Newbie
Posts: 3
Joined: Tue Jan 03, 2006 8:40 pm

Post by eye_onme »

[quote="Dm7"]Wowthat'ssobeautiful...:P

Cannot display Chinese What a pety
eye_onme
Forum Newbie
Posts: 3
Joined: Tue Jan 03, 2006 8:40 pm

Post by eye_onme »

Cannot display Chinese What a pety[/quote]
I change the code

now it can display Chinese and Enghlish

Code: Select all

<?php
    if(!empty($HTTP_POST_VARS['textbox']))
    {
        $string = $HTTP_POST_VARS['textbox'];
        $steps = strlen($string);
        $r = 255; $g = 0; $b = 255;
        $step = 255 / ceil($steps/5);
        echo '<textarea rows="15" name="output" cols="45" style="width:100%">';
        $y=0;
		for ($x=0;$x<$steps;$x++)
        {
			if ($y%ceil($steps/5) == 0)
			{
				$s++;
			}
			switch ($s)
			{
				case 1: $b -= $step; break;
				case 2: $g += $step; break;
				case 3: $r -= $step; break;
				case 4: $b += $step; break;
				case 5: $g -= $step; break;
			}

		   if(ord(substr($string,$x,1))<0x81)
			{
				echo "[color=#".sprintf("%02X%02X%02X",$r,$g,$b)."]".$string{$x}."[/color]";

			}
			else/*if(ord(substr($string,$x,1))>=0x81)*/
			{
				echo "[color=#".sprintf("%02X%02X%02X",$r,$g,$b)."]".$string{$x}.$string{$x+1}."[/color]";
				$x++;
			}
			$y++;
        }
        echo '</textarea><br />';
    }
?>
Example:



RPC
djot
Forum Contributor
Posts: 313
Joined: Wed Jan 14, 2004 10:21 am
Location: planet earth
Contact:

Post by djot »

-
Why didn't onion2k use GD for it?
:)

djot
-
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

djot wrote:-
Why didn't onion2k use GD for it?
:)

djot
-
Because it's outputting text..
Post Reply