changeset 2:aca6e52b682e

Cleanups.
author ccr@tnsp.org
date Sat, 18 Dec 2010 16:35:38 +0200
parents 868229501554
children c99ef0e7f8db
files kuva.php
diffstat 1 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/kuva.php	Sat Dec 18 16:27:41 2010 +0200
+++ b/kuva.php	Sat Dec 18 16:35:38 2010 +0200
@@ -1,16 +1,22 @@
-<?php 
+<?
 if (!extension_loaded('gd')) {
    if (!dl('gd.so')) {
+       echo "Could not load extension GD!";
        exit;
    }
 }
-header("content-type:image/png");
-$image=imagecreate(12,80);
-$black=imagecolorallocate($image,0,0,0);
-$white=imagecolorallocate($image,255,255,255);
+
+$text = isset($_GET["text"]) ? $_GET["text"] : "-";
+
+$image = imagecreate(12, 80);
+$c_black = imagecolorallocate($image,   0,   0,   0);
+$c_white = imagecolorallocate($image, 255, 255, 255);
 
-imagefill($image,0,0,$black);
-imagestringup($image,2,-2,78,$_GET["text"],$white);
+imagefill($image, 0, 0, $c_black);
+imagestringup($image, 2, -2, 78, $text, $c_white);
+
+header("Content-Type: image/png");
 imagepng($image);
+
 imagedestroy($image);
 ?>
\ No newline at end of file