All pastes #962971 Raw Edit

Miscellany

public text v1 · immutable
#962971 ·published 2008-03-30 04:01 UTC
rendered paste body
<?php

function check500($num)
{
   if ($num >= 500)
   {
       return 500;
   }
   else
   {
       return $num;
   }
}

$quotes = array(
'Quote 1',
'Quote 2',
'Quote 3',
'Quote 4',
'Quote 5'
);

$dayslived = abs(gregorianToJD(9, 15, 1987) - gregorianToJD(date( "m"), date( "d"), date( "Y")));

$lines = explode("\n", wordwrap(('' . $quotes[array_rand($quotes)] . ''),
82, "\n"));

for ($i = 0, $long = 0; $i < count($lines); $i++)
{
   if (strlen($lines[$i]) > $long)
   {
       $long = strlen($lines[$i]);
   }
}

$im = imagecreate(500, 220);
$background = imagecolorallocate($im,255,255,255);
$border = imagecolorallocate($im,0,0,0);
$text = imagecolorallocate($im,0,0,0);
$text2 = imagecolorallocate($im,150,0,0);

imagefill($im, 0, 0, $background);
imagestring($im, 2, 190, 23, "(((Random Quote)))", $text);

for ($i = 0, $l = 40; $i < count($lines); $i++, $l += 17)
{
   imagestring($im, 2, 5, $l, $lines[$i], $text);
}

imageline($im, 0, 18, 499, 18, $border);
imagestring($im, 5, 1, 1, "USERNAME HERE", $text); //Input username.
imagestring($im, 2, 290, 3, "Short description of you.", $text); //May need to adjust the x-position (second number).
imageline($im, 0, 148, 499, 148, $border);

$time_in_seconds = time() + 60 * 60 * 1; 
$time = date( 'g:i A', $time_in_seconds); 

imagestring($im, 2, 239, 150, "Current time where USERNAME lives: - $time", $text); //May need to modify the equation depending on where your server is located, add or subtrack an hour or so.
$dayslived = abs(gregorianToJD(MONTH HERE, DAY HERE, FULL YEAR HERE) - gregorianToJD(date( "m"), date( "d"), date( "Y"))); //Input your birthdate here for the biorhythm and number of days to work.
imagestring($im, 2, 3, 150, "Rydian has been alive for $dayslived days.", $text);

$dayslived = abs(gregorianToJD(MONTH HERE, DAY HERE, FULL YEAR HERE) - gregorianToJD(date( "m"), date( "d"), date( "Y"))); //Once again, input birthdate.
$pi = M_PI;
$physical = sin((2*$pi*$dayslived)/23);
$emotional = sin((2*$pi*$dayslived)/28);
$intellectual = sin((2*$pi*$dayslived)/33);
$mastery = ($intellectual+$physical)/2;
$passion = ($physical+$emotional)/2;
$wisdom = ($emotional+$intellectual)/2;
function determinephase($arg1)
{
if ($arg1 == 0)
{$arg1 = "Catastrophe!";}
if ($arg1 > 0)
{$arg1 = "Active.";}
if ($arg1 < 0)
{$arg1 = "Passive.";}
return $arg1;
}
$physical = "Physical:  " . determinephase($physical);
$intellectual = "Intellect: " . determinephase($intellectual);
$emotional = "Emotional: " . determinephase($emotional);
$mastery = "Mastery: " . determinephase($mastery);
$passion = "Passion: " . determinephase($passion);
$wisdom = "Wisdom: " . determinephase($wisdom);

imageline($im, 0, 165, 499, 165, $border);

imagestring($im, 3, 100, 178, "USERNAME's current biorhythm readings below.", $text); //Username here.

imagestring($im, 2, 5, 196, $physical, $text);
imagestring($im, 2, 5, 208, $intellectual, $text);
imagestring($im, 2, 360, 196, $emotional, $text);

imagestring($im, 2, 190, 196, $mastery, $text);
imagestring($im, 2, 190, 208, $passion, $text);
imagestring($im, 2, 378, 208, $wisdom, $text);

header('Content-Type: image/gif');
imagegif($im);
imagedestroy($im);
?>>