PDA

View Full Version : Completely Random Font Colours For Graffiti Wall


sabret00the
04-27-2005, 10:00 PM
Open "wall.php" and find:
$randcolor = rand(1,9);
if ( $randcolor == 1 ) $color = ImageColorAllocate($myimage, 255, 255, 0);
elseif ( $randcolor == 2 ) $color = ImageColorAllocate($myimage, 255, 165, 0);
elseif ( $randcolor == 3 ) $color = ImageColorAllocate($myimage, 255, 20, 147);
elseif ( $randcolor == 4 ) $color = ImageColorAllocate($myimage, 255, 0, 0);
elseif ( $randcolor == 5 ) $color = ImageColorAllocate($myimage, 255, 255, 255);
elseif ( $randcolor == 6 ) $color = ImageColorAllocate($myimage, 0, 255, 255);
elseif ( $randcolor == 7 ) $color = ImageColorAllocate($myimage, 255, 0, 255);
else $color = ImageColorAllocate($myimage, 0, 255, 0);

and replace with
// +++ completely random colours
$randred = rand(1,255);
$randgreen = rand(1,255);
$randblue = rand(1,255);

$color = ImageColorAllocate($myimage, $randred, $randgreen, $randblue);
// --- completely random colours

now save and upload and you're done :)

nexialys
04-28-2005, 12:41 PM
would be good to add a button on the wall entry field to select a random or not... this is good feature!

Vevina
04-28-2005, 12:41 PM
Sweet installed :)

frankenberrie
04-28-2005, 07:11 PM
Installed

vulture
04-28-2005, 09:39 PM
The problem on my board is that it generates too many dark colours. Fix it by having the random value from 150-255

// +++ completely random bright colours
$randred = rand(150,255);
$randgreen = rand(150,255);
$randblue = rand(150,255);

$color = ImageColorAllocate($myimage, $randred, $randgreen, $randblue);
// --- completely random bright colours

jugo
04-29-2005, 01:37 AM
thanks

/me installs

MP3
04-29-2005, 05:06 AM
any prnt scrn?? :(

Deska
04-29-2005, 07:55 AM
Thank's for this hack!

MPDev
04-30-2005, 01:26 AM
While developing the Wall I found that random colors didn't render well and I got alot of purple or brown even when it was trying to render some off yellow color. Sticking close to primaries will ensure as close as possible colors.

sabret00the
04-30-2005, 05:39 AM
While developing the Wall I found that random colors didn't render well and I got alot of purple or brown even when it was trying to render some off yellow color. Sticking close to primaries will ensure as close as possible colors.
i've been playing with this, it's a matter of php's favouritism to certain numbers, i've been trying to circumvent this with $randred = mt_rand(1,255);
$randgreen = ceil(rand(1,85) + ceil(rand(1,170) / 2) + rand(1,85));
$randblue = ceil(rand(1,510) / 2);
but really i'm just playing with it.

Allan
04-30-2005, 10:29 PM
Thanks "sabret00the" ;)


~~~~~~~~~~~~~~~~
Click Install :)
~~~~~~~~~~~~~~~~

Trigunflame
05-01-2005, 02:59 AM
use switch young padawan.

ombossman
05-01-2005, 10:22 AM
wall.php where ? i dont find it

y2krazy
08-21-2006, 11:43 PM
Working with 3.6.0 Gold. :)