images not being displayed correctly

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
hwttdz
Forum Newbie
Posts: 7
Joined: Wed May 25, 2005 7:48 am

images not being displayed correctly

Post by hwttdz »

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

Code: Select all

&lt;IMG SRC=&quote;imgtest3.php?type=#&quote;&gt;
&lt;IMG SRC=&quote;imgtest3.php?type=#&quote;&gt;
with both types set to the same number it works. However if I do

Code: Select all

&lt;IMG SRC=&quote;imgtest3.php?type=1&quote;&gt;
&lt;IMG SRC=&quote;imgtest3.php?type=2&quote;&gt;
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:

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");
?>
imgtest3.php

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);
}
?>
Where I know makedots works.
Post Reply