Technology Epitaffio

net02

Typing Monkey
toh guarda che bello non avevo voglia di scrivere e ho trovato subito un esempio
questo è tipo tutto il codice che ti serve, lo salvi come .php e lo uppi da qualche parte

PHP:
<?
//Chooses a random number
$num = Rand (1,6);
//Based on the random number, gives a quote
switch ($num)
{
case 1:
echo "Time is money";
break;
case 2:
echo "An apple a day keeps the doctor away";
break;
case 3:
echo "Elmo loves dorthy";
break;
case 4:
echo "Off to see the wizard";
break;
case 5:
echo "Tomorrow is another day";
break;
case 6:
echo "PHP is cool!";
}
?>

questo esempio ovviamente fa cagare, anzichè echo puoi usare n altri modi per sparaflashare fuori il testo, puoi fare quanti casi vuoi etcetcetc con poche modifiche.
in effetti non so però con che tag lo linki in sign..

(l'esempio è preso da qua http://php.about.com/od/finishedphp1/p/random_quote.htm )
 

net02

Typing Monkey
PHP:
<?
$num = Rand (1,6);
switch ($num)
{
case 1:
$txt = "Time is money";
break;
case 2:
$txt = "An apple a day keeps the doctor away";
break;
case 3:
$txt = "Elmo loves dorthy";
break;
case 4:
$txt = "Off to see the wizard";
break;
case 5:
$txt = "Tomorrow is another day";
break;
case 6:
$txt = "PHP is cool!";
}

header("Content-type: image/png");
$im = @imagecreate(110, 20)
  or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 0, 0, 0);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5, $txt, $text_color);
imagepng($im);
imagedestroy($im);
?>

poi lo metti con un semplice tag img come in questo caso

asd.php


divertiti con i numerelli delel varie funzioni: (110, 20) sono lunghezza e altezza, lo 0, 0, 0 del primo imagecolorallocate sono r,g,b dello sfondo, mentre quelli del secondo sono il colore della scritta. i parametri della funzione imagestring (1,5,5) sono relativi alla dimensione del font e all'offset della scritta. Cambiare font mi pare sia un bordello epocale :awk:
 
Alto