Page 2 of 2

Posted: Tue Jan 03, 2006 11:31 pm
by eye_onme
[quote="Dm7"]Wowthat'ssobeautiful...:P

Cannot display Chinese What a pety

Posted: Wed Jan 04, 2006 12:36 am
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

Posted: Wed Jan 04, 2006 4:48 am
by djot
-
Why didn't onion2k use GD for it?
:)

djot
-

Posted: Wed Jan 04, 2006 8:02 am
by onion2k
djot wrote:-
Why didn't onion2k use GD for it?
:)

djot
-
Because it's outputting text..