Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Dorobienie okna z wpisywaniem wartości
dslr
post 26.01.2010, 18:37:37
Post #1





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 18.01.2010

Ostrzeżenie: (0%)
-----


Witam
Bardzo proszę o pomoc w następującym temacie.
Poniżej wklejam list "Speedometru". W liście ImageLine ...... (tam gdzie jest wartość -300) można wpisywać różne wartości i wtedy strzałka na traczy się przesuwa o tą wartość.
Chodzi o to żeby dorobić pole tekstowe w które będzie się wpisywać wartości a strzałka się będzie przesuwać - tak by nie trzeba było tego robić w pliku edytowalnym za pomocą notatnika.
Nie potrafię sobie z tym poradzić - bardzo proszę o pomoc.

<?php
if (! $size > 0)
{
$size = 300;
}

$radius = floor($size / 2);

header("content-Type: image/gif");
header("refresh: 1");
$img = ImageCreate($size, $size);
$color_alpha = ImageColorAllocate($img, 254, 254, 254);
$color_white = ImageColorAllocate($img, 255, 255, 255);
$color_black = ImageColorAllocate($img, 0, 0, 0);
$color_gray = ImageColorAllocate($img, 192, 192, 192);
$color_red = ImageColorAllocate($img, 255, 0, 0);
$color_blue = ImageColorAllocate($img, 0, 0, 255);
ImageColorTransparent($img, $color_alpha);
ImageArc($img,$radius, $radius, $size, $size, 180, 360, $color_black);
ImageFill($img, $radius, $radius, $color_white);
$min = 15;
while($min++ < 44 ) {
if ($min %45 == 0)
$len = $radius /10;
elseif ($min%5 == 0)
$len = $radius / 10;
else
$len = $radius / 30;

$ang = (2 * M_PI * $min) / 60;
$x1 = sin($ang) * ($radius - $len) + $radius;
$y1 = cos($ang) * ($radius - $len) + $radius;
$x2 = (1 + sin($ang)) * $radius ;
$y2 = (1 + cos($ang)) * $radius;
ImageLine($img, $x1, $y1, $x2, $y2, $color_black);
}

$xm = intval(($min * M_PI/1 - M_PI/1));


ImageLine($img, $radius, $radius, $xm-300, $ym, $color_blue); // tu mamy w kazda strone po 360

stopni od srodka wiec jesli chcemy ustawic np polowe od 0 do 50 to ustawiamy - 180 jesli chcemy

polowe do setki to 180





imageline($img, $radius /222 , $radius, $radius * 16, $radius, $color_black);

ImageArc($img, $radius, $radius, $radius / 8, $radius / 8, 1, 360, $color_red);
ImageFillToBorder($img, $radius, $radius, $color_red, $color_red);

//MOJE DANE
$text = '0';
$font = 'arial.ttf';
$text2 = '100';
$text3 = '50';

imagettftext($img, $radius/6, $radius/180, $xm-130, $ym+160, $color_red, $font, $text);
imagettftext($img, $radius/6, $radius/180, $xm+100, $ym+160, $color_red, $font, $text2);
imagettftext($img, $radius/6, $radius/180, $xm-10, $ym+30, $color_red, $font, $text3);

ImagePNG($img);
ImageDestroy($img);
?>

Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 04:42