I'm building a site that generates images from what will be a database query. I've built this to create the relevant images
<?
// header
Header("Content-Type: image/gif");
// select image to build onto
switch ($baseimg){
case today:
$im = ImageCreateFromGIF('/home/httpd/vhtdocs/iain/gdtest/todayball.gif');
break;
case todaybonusball:
$im = ImageCreateFromGIF('/home/httpd/vhtdocs/iain/gdtest/todaybonusball.gif');
break;
case odd:
$im = ImageCreateFromGIF('/home/httpd/vhtdocs/iain/gdtest/oddball.gif');
break;
case oddbonusball:
$im = ImageCreateFromGIF('/home/httpd/vhtdocs/iain/gdtest/oddbonusball.gif');
break;
case even:
$im = ImageCreateFromGIF('/home/httpd/vhtdocs/iain/gdtest/evenball.gif');
break;
case evenbonusball:
$im = ImageCreateFromGIF('/home/httpd/vhtdocs/iain/gdtest/evenbonusball.gif');
break;
}
//create the text image
$text = imagecreate(40, 40);
// allocate colors
$white = imagecolorallocate($text, 250,250,250);
$black = imagecolorallocate($text, 0,0,0);
//create image to hold text
imagettftext ($text, 16, 0, 8, 28, $black, '/home/httpd/vhtdocs/iain/gdtest/arial.ttf', $draw);
//make transparent the background
$white = imagecolortransparent($text,$white);
imagecopy($im, $text, 0,0,0,0, 40,40);
imagedestroy ($text);
// output to browser
imagegif($im);
imagedestroy($im);
?>
Its called from a combination of these scripts at the moment.
<?php
function imgCreate($draw_array, $baseimg)
{
$bonusBall = array_pop($draw_array);
// loop for each item in array
foreach($draw_array as $draw){
echo "<img src=\"gdtest02.php?baseimg=".$baseimg."&draw=$draw\" border=0> ";
}
echo "<img src=\"gdtest02.php?baseimg=".$baseimg."bonusball&draw=$bonusBall\" border=0> ";
}
?>
<?
$todays_nums = Array();
$todays_nums[0] = "42";
$todays_nums[1] = "05";
$todays_nums[2] = "09";
$todays_nums[3] = "14";
$todays_nums[4] = "48";
$todays_nums[5] = "36";
$todays_nums[6] = "47";
$baseimg = today;
imgCreate($todays_nums, $baseimg);
?>
But there is a real oddity in what is produced which I can only explain by directing you here
www.suppose.co.uk/gdtest/
I can't figure out why it would be doing this at all. Why does it work for one but none of the rest?
It's for a piece called the Lottery Predictions if you're interested.
Cheers to anyone that can help.