next one: graphics

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

next one: graphics

Post 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);
?>
User avatar
hex
Forum Commoner
Posts: 92
Joined: Sat Apr 20, 2002 3:20 am
Location: UK

Post 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!
User avatar
sam
Forum Contributor
Posts: 217
Joined: Thu Apr 18, 2002 11:11 pm
Location: Northern California
Contact:

GD foo

Post 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...
User avatar
hex
Forum Commoner
Posts: 92
Joined: Sat Apr 20, 2002 3:20 am
Location: UK

Post 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!
User avatar
hex
Forum Commoner
Posts: 92
Joined: Sat Apr 20, 2002 3:20 am
Location: UK

Post 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:
Post Reply