Forum Moderators: coopster
texttest3.php
<?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");?>
localhost/imgtest3.php?type=1 or localhost/imgtest3.php?type=2
both of these work exactly as they should.
The display I get sometimes displays part of the images, usually just a bit at the top then some sort of static looking stuff then it goes all black. Sometimes I get an apache server error as well.
<?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
<?php
//start of main
header("Content-type: image/gif");
ini_set("display_errors", "On");
$link = @mysql_connect('localhost', 'user', 'mypass')
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);
imagegif($image);
//end of main
function drawimage($link,$type)
{
if($type==1)$image = imagecreatefromgif("map.gif");
if($type==2)$image = imagecreatefromgif("map2.gif");
$query = "SELECT * FROM table2ll WHERE status=1"; //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";//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";//select clear sites
$result = @mysql_query($query,$link) or die("Could not submit query");
makedots($image, $result,3);
return($image);
}
<?php
//start of main
header("Content-type: image/gif");
ini_set("display_errors", "On");
$type=$_GET['type'];
$image=drawimage($link,$type);
imagegif($image);
//end of main
function drawimage($link,$type)
{
if($type==1)$image = imagecreatefromgif("map.gif");
if($type==2)$image = imagecreatefromgif("map2.gif");
return($image);
}
?>
Try using this and see if it works... If it does, it might be something in your SQL causing it.
anyway, the only difference i can find is within these lines:
[tt]if($type==1)$image = imagecreatefromgif("map.gif");
if($type==2)$image = imagecreatefromgif("map2.gif");[/tt]
i guess that map2.gif does not exists. it's only a guess but i think the error can be found here or the image is to small to be drawn on etc. pp. my shoot is the difference between these to .gif files.
--hakre
Right now the code of imgtest3.php is
<?php
//start of main
header("Content-type: image/gif");
ini_set("display_errors", "On");
$type=$_GET['type'];
$image=drawimage(1,$type);
imagegif($image);
//end of main
function drawimage($link,$type)
{
$image = imagecreatefromgif("map.gif");
return($image);
}
?>
The page that I'm trying to view is:
<IMG SRC="ita.php?type=1">
<IMG SRC="ita.php?type=2">
and ita.php is
<?php
header("Content-type: image/gif");
$image=imagecreatefromgif("map.gif");
imagegif($image);
?>
This works if whatever comes after IMG SRC=" is exactly the same in each case, but if I pass a get parameter it crashes, and if I save one copy of ita as ita2 it crashes. But if I set one to map.gif and the other to map2.gif it works.