images not being displayed correctly
Posted: Thu Jun 16, 2005 12:52 pm
I have a piece of php code that I know to create the correct image because if I call up that piece of php I get what I want. But when I try to make two images from the same php code I do not get the correct image. What the php file does is draw a background, then plot different coordinates on the plot. Some of the coordinates are type 1 some are type two so I call it like <IMG SRC="imgtest3.php?type=1"> or <IMG SRC="imgtest3.php?type=2"> if I say just http://localhost/joe/imgtest3.php?type=2 or with type=1 it works and if I have
with both types set to the same number it works. However if I do
It does not work. The background image becomes all black except for a little interference at the top. However the dots are still all plotted correctly without interference. I really have no idea what the problem is. Any help would be appreciated.
Here's more code if it helps:
imgtest3.php
Where I know makedots works.
Code: Select all
<IMG SRC="e;imgtest3.php?type=#"e;>
<IMG SRC="e;imgtest3.php?type=#"e;>Code: Select all
<IMG SRC="e;imgtest3.php?type=1"e;>
<IMG SRC="e;imgtest3.php?type=2"e;>Here's more code if it helps:
Code: Select all
<?php
ini_set("display_errors", "On");
echo("this is text before the picture <br>");
?>
<IMG SRC="imgtest3.php?type=1">
<IMG SRC="imgtest3.php?type=2">
<br>
<?php
echo("this is text after the picture");
?>Code: Select all
<?php
//start of main
header("Content-type: image/gif");
ini_set("display_errors", "On");
$link = @mysql_connect('localhost', 'user', 'password') or die("Could not connect to MySQL");
$db = @mysql_select_db('temp2',$link) or die("Could not select database");
$type=$_GET['type'];
$image=drawimage($link,$type);
//imageinterlace($image,0);
imagegif($image);
//end of main
function drawimage($link,$i)
{
$image = imagecreatefromgif("map.gif");
$query = "SELECT * FROM table2ll WHERE status=1 AND type=".$i; //select green sites
$result = @mysql_query($query,$link) or die("Could not submit query1");
makedots($image, $result, 1);
$query = "SELECT * FROM table2ll WHERE status=2 AND type=".$i;//select red sites
$result = @mysql_query($query,$link) or die("Could not submit query");
makedots($image, $result,2);
$query = "SELECT * FROM table2ll WHERE status=3 AND type=".$i;//select clear sites
$result = @mysql_query($query,$link) or die("Could not submit query");
makedots($image, $result,3);
return($image);
}
?>