Page 1 of 1

next one: graphics

Posted: Tue Jul 23, 2002 6:33 pm
by volka
(no need to wait for rules - have fun ;) )
Sudden death (free for all)
Max lines per edit: 3
Time limit: None

from http://www.php.net/manual/en/function.imagecreate.php

Code: Select all

<?php
header ("Content-type: image/png");
$im = @imagecreate (50, 100)
    or die ("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate ($im, 255, 255, 255);
$text_color = imagecolorallocate ($im, 233, 14, 91);
imagestring ($im, 1, 5, 5,  "A Simple Text String", $text_color);
imagepng ($im);
?>

Posted: Wed Jul 24, 2002 4:11 am
by hex

Code: Select all

<?php 
header ("Content-type: image/png");
$im = @imagecreate (210, 50)
    or die ("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate ($im, 255, 255, 255);
$text_color = imagecolorallocate ($im, 233, 14, 91);
$arc_color  = imagecolorallocate ($im, 0, 220, 0);
imagefilledarc ($im, 10, 20, 400, 20, 0, 100, $arc_color, IMG_ARC_PIE);
imagestring    ($im, 5, 5, 15,  "h3x 15 13373r 7h4n j00", $text_color);
imagepng       ($im);
?>
GD is hard on an 80 char limit!

GD foo

Posted: Sun Aug 11, 2002 11:14 am
by sam

Code: Select all

<?php
header ("Content-type: image/png");
$im = @imagecreate (210, 50)
    or die ("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate ($im, 255, 255, 255);
$text_color = imagecolorallocate ($im, 233, 14, 91);
$arc_color  = imagecolorallocate ($im, 0, 220, 0);
$border_color  = imagecolorallocate ($im, 0, 0, 0); // black
imagefilledarc ($im, 10, 20, 400, 20, 0, 100, $arc_color, IMG_ARC_PIE);
imagestring    ($im, 5, 5, 15,  "h3x 15 13373r 7h4n j00", $text_color);
imagerectangle ($im,0,0,209,49,$border_color); // add a little border
imageline ($im,5,20,200,25,$border_color); // The truth (you know it hex :) ) LOL
imagepng       ($im);
?>
Yeah GD is hard because you can not get a sucessive multi part feature vollied across well...

Posted: Tue Aug 20, 2002 3:03 pm
by hex

Code: Select all

&lt;?php
header ("Content-type: image/png");
$im = @imagecreate (210, 50)
    or die ("Cannot Initialize new GD image stream");
$white = imagecolorallocate ($im, 255, 255, 255);
$red   = imagecolorallocate ($im, 233, 14,  91);
$blue  = imagecolorallocate ($im, 0,   0,   255);
$green = imagecolorallocate ($im, 0,   220, 0);
$black = imagecolorallocate ($im, 0,   0,   0);
imagefilledarc ($im, 10, 17,  400, 30, 0, 100, $green, IMG_ARC_PIE);
imagestring    ($im, 5,  5,   15,  "h3x 15 13373r 7h4n j00", $red);
imagestring    ($im, 3,  145, 30,  "(and sam)", $blue);
imagerectangle ($im, 0,  0,   209, 49, $black);
imageline      ($im, 5,  30,  200, 30, $black);
imagepng       ($im);
?&gt;
Laaaaaa!

Posted: Tue Aug 20, 2002 3:05 pm
by hex

Code: Select all

<?php 
header ("Content-type: image/png"); 
$im = @imagecreate (210, 50) 
or die ("Cannot Initialize new GD image stream"); 
$white = imagecolorallocate ($im, 255, 255, 255); 
$red = imagecolorallocate ($im, 233, 14, 91); 
$blue = imagecolorallocate ($im, 0, 0, 255); 
$green = imagecolorallocate ($im, 0, 220, 0); 
$black = imagecolorallocate ($im, 0, 0, 0); 
imagefilledarc ($im, 10, 17, 400, 30, 0, 100, $green, IMG_ARC_PIE); 
imagestring ($im, 5, 5, 15, "h3x 15 13373r 7h4n j00", $red); 
imagestring ($im, 3, 145, 30, "(and sam)", $blue); 
imagerectangle ($im, 0, 0, 209, 49, $black); 
imageline ($im, 5, 30, 200, 30, $black); 
imagepng ($im); 
?>
Wrong tags :oops: