August 2001
Using phpimage()
, imagecreate
, imagestring()
, imagepng()
<?php
Header("Content-Type: image/gif");
if (!isset($part)) {
$part = "all";
}
if (!isset($string) || $string <= "") {
$string = "Go!";
}
$chars = strlen($string);
$height = ImageFontHeight(5);
$width = ImageFontWidth(5);
$str_width = $width * $chars;
$str_height = $height;
$img_width = $str_width + 40;
$img_height = $str_height + 40;
$img_center_x = $img_width / 2;
$img_center_y = $img_height / 2;
$id = ImageCreate($img_width, $img_height);
$black = ImageColorAllocate($id, 0, 0, 0);
$blue = ImageColorAllocate($id, 0, 0, 255);
$green = ImageColorAllocate($id, 0, 255, 0);
$red = ImageColorAllocate($id, 255, 0, 0);
$white = ImageColorAllocate($id, 255, 255, 255);
$transparent = ImageColorTransparent($id, $white);
ImageFill($id, 0, 0, $white);
if ($part == "transparent") {
ImageGIF($id);
exit;
}
ImageArc($id, $img_center_x, $img_center_y, (($width * $chars) + 28), ($height + 28), 0, 360, $black);
if ($part == "border") {
ImageGIF($id);
exit;
}
ImageFill($id, $img_center_x, $img_center_y, $black);
if ($part == "black") {
ImageGIF($id);
exit;
}
ImageArc($id, $img_center_x, $img_center_y, (($width * $chars) + 24), ($height + 24), 0, 360, $green);
ImageFill($id, $img_center_x, $img_center_y, $green);
if ($part == "fill") {
ImageGIF($id);
exit;
}
ImageString($id, 5, ($img_center_x - (($width * $chars) / 2) + 1), ($img_center_y - ($height / 2)), $string, $black);
ImageGIF($id);
<?php
$font = "gdFontLarge";
$font = 1;
$x = 2;
$y = 2;
$image = imagecreate(100, 300);
$black = imagecolorallocate($image, 0, 0, 0);
$white = imagecolorallocate($image, 255, 255, 255);
$color = $black;
for ($i = 0; $i <= 32; $i++) {
imagestring($image, $font, $x, $y + ($i * 9), "ArtLung $i", $white);
}
header("Content-Type: image/png");
imagepng($image);
imagedestroy($image);