All pastes #627076 Raw Edit

Someone

public text v1 · immutable
·published 2007-07-20 02:35 UTC
rendered paste body
<?php
foreach ($_GET as $key => $value) { $_GET[strtolower($key)] = $value; } 

header("Content-type: image/png");
$string = $_GET['text'];
$image     = imagecreatefrompng("images/my_santa_.PNG");


// START OF COLOR LIST
$orange = imagecolorallocate($image, 220, 210, 60);
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);
$yellow = imagecolorallocate($image, 255, 255, 0, 75);
$red = imagecolorallocate($image, 255, 0, 0, 75);
$blue = imagecolorallocate($image, 0, 0, 255, 75);
$green = imagecolorallocate($image, 0, 255, 0);
// END OF COLORS LIST



// SET COLOR
switch (strtoupper($_GET['color'])) {
  case "ORANGE";
     $color = $orange;
     break;
  case "WHITE":
     $color = $white;
     break;
  case "BLACK":
     $color = $black;
     break;
  case "YELLOW":
     $color = $yellow;
     break;
  case "RED":
     $color = $red;
     break;
  case "BLUE":
     $color = $blue;
     break;
  case "GREEN":
     $color = $green;
     break;
  default:
     $color = $black;
}
// END OF SETTING COLOR


$px     = (imagesx($im) - 7.5 * strlen($string)) / 2;
imagestring($image, 3, $px, 9, $string, $orange);
imagepng($image);
imagedestroy($image);

?> 

/*  $color = array();
$color['green'] = imagecolorallocate($image, 0, 255, 0); 
$color['orange'] = imagecolorallocate($image, 220, 210, 60);
$color['white'] = imagecolorallocate($image, 255, 255, 255);
$color['black'] = imagecolorallocate($image, 0, 0, 0);
$color['yellow'] = imagecolorallocate($image, 255, 255, 0, 75);
$color['red'] = imagecolorallocate($image, 255, 0, 0, 75);
$color['blue'] = imagecolorallocate($image, 0, 0, 255, 75);
$c = $color[strtolower($_GET['color'])]; */