Welcome to Gaia! ::

My Design :: Web and Graphic Design [HTML CSS PHP]

Back to Guilds

XHTML, CSS, jQuery, Javascript, PHP, mySQL, MORE! 

Tags: design, graphics, html, jquery, javascript 

Reply Server Side Programming
Here, use these.

Quick Reply

Enter both words below, separated by a space:

Can't read the text? Click here

Submit

Rydian Morrison

PostPosted: Sun Jul 16, 2006 1:15 am


Here's some small scripts. Mostly for image creation in your sig, so you can get all fancified in your sigs. ... yo. Some of these might be mid-upgrade and not work, or have a bug or two, if anything wrong is noticed, tell me, or tell me how to fix it.

IP signature image
header("Content-type: image/png");
$theirip = $_SERVER['REMOTE_ADDR'];
$text1 = "Your IP address is $theirip.";
$text2 = "This is Rydian Morrison's signature.";
$text3 = "And he humps legs. D:";
$mainimage = imagecreate(500,100);
$basecolor = imagecolorallocate($mainimage,0,255,255);
$textcolor = imagecolorallocate($mainimage,200,0,0);
imagefill($mainimage,0,0,$basecolor);
Imagestring($mainimage,4,2,0,$text1,$textcolor);
Imagestring($mainimage,4,2,12,$text2,$textcolor);
Imagestring($mainimage,4,2,24,$text3,$textcolor);
imagepng($mainimage);
imagedestroy($mainimage);
?>


random quote
function check500($num)
{if ($num >= 500)
{return 500;}
else
{return $num;}}
$quotes = array(
'Quote 1 is this.',
'Quote 2 is this.',
'Quote 3 is this.'
);
$lines = explode("n", wordwrap(('"' . $quotes[array_rand($quotes)] . '"'),
80, "n"));
for ($i = 0, $long = 0; $i < count($lines); $i++)
{ if (strlen($lines[$i]) > $long)
{$long = strlen($lines[$i]);}}
$im = imagecreate(check500($long * 6 + 9), check500(count($lines) * 17 +
3));
$background = imagecolorallocate($im, 0, 0, 0);
$text = imagecolorallocate($im, 255, 255, 255);
imagefill($im, 0, 0, $background);
for ($i = 0, $l = 3; $i < count($lines); $i++, $l += 17)
{imagestring($im, 2, 5, $l, $lines[$i], $text);}
imagerectangle($im, 0, 0, (imagesx($im) - 1), (imagesy($im) - 1), $background);
imagerectangle($im, 1, 1, (imagesx($im) - 2), (imagesy($im) - 2), $text);
header('Content-Type: image/png');
imagepng($im);
imagedestroy($im);
?>


Random image from directory
header ("content-type: image/gif");
$path = '/home/rydian/public_html/shop/randomimage/rydian/images/';
$i = 0;
$imgDir = opendir ($path);
while ( $file = readdir( $imgDir ) )
{ $file_type = strrchr( $file, "." );
$is_image = eregi( "jpg|gif|png",$file_type );
if ( $file != '.' && $file != '..' && $is_image )
{ $images[$i++] = $file; }}
closedir ($imgDir);
srand( (double) microtime()*1000000 );
$image_name = $path . '/' . $images[rand( 0,sizeof( $images ) -1 )];
$imgSize = GetImageSize( $image_name );
if ( $i == 0 )
die();
readfile("$image_name");
?>
PostPosted: Sat Jul 22, 2006 8:42 pm


Thank you very much for posting things like this! We need people like you here, thanks.

z!p


Rydian Morrison

PostPosted: Sun Jul 30, 2006 11:02 pm


Thank you. ^^

I have a few more, but they're not completed, or look bad, or are variations of things I've already posted.
PostPosted: Fri Aug 18, 2006 12:06 am


header("Content-type: image/png")
$theirip = $_SERVER['REMOTE_ADDR']
$text1 = "Your IP address is " . $theirip . "."; //this line here xD
$text2 = "This is Rydian Morrison's signature.";
$text3 = "And he humps legs. D:";
$mainimage = imagecreate(500,100)
$basecolor = imagecolorallocate($mainimage,0,255,255)
$textcolor = imagecolorallocate($mainimage,200,0,0)
imagefill($mainimage,0,0,$basecolor)
Imagestring($mainimage,4,2,0,$text1,$textcolor)
Imagestring($mainimage,4,2,12,$text2,$textcolor)
Imagestring($mainimage,4,2,24,$text3,$textcolor)
imagepng($mainimage)
?>


just to be annoying... as far as i know you can't put variables in quotes :B

Hoggs
Vice Captain


Rydian Morrison

PostPosted: Fri Aug 18, 2006 10:46 am


Depends on the kind of quote used, actually, single or double.
PostPosted: Sat Aug 19, 2006 9:29 pm


Wow... you were right sweatdrop

Hoggs
Vice Captain


Peng

PostPosted: Sun Aug 20, 2006 1:59 am


Rydian, you aren't calling imagedestroy() in the first script. gonk

Edit: Damnit, "gonk" emoticon. Work!
PostPosted: Tue Aug 22, 2006 8:27 pm


Like I said, some might have a bug or two. >_>; Thankies, will edit.

Rydian Morrison


Peng

PostPosted: Thu Aug 24, 2006 6:26 am


smile
Reply
Server Side Programming

 
Manage Your Items
Other Stuff
Get GCash
Offers
Get Items
More Items
Where Everyone Hangs Out
Other Community Areas
Virtual Spaces
Fun Stuff
Gaia's Games
Mini-Games
Play with GCash
Play with Platinum