Forum Moderators: coopster
the website consists of tables.
all the content comes into one <td> with php include() as you can see here:
<?php
echo '<br />';
if (isset($_GET['page']) && $_GET['page']!= ''){
include($_GET['page']);
}
else
include('home.htm');
?>
I also created the following file to get the pictures from the database and show them as thumbnails:
<?php
$dir = 'images/albums/brasschaat/';
$conn = mysql_connect("localhost","?","?");
mysql_select_db("?",$conn);
$query = 'select id, naam from foto_brasschaat';
$result = mysql_query($query,$conn);
$teller = 0;
while ($row = mysql_fetch_array($result)) {
if ($teller%5 == 0) {
echo '</tr></table><table><tr align="left">';
}
echo '<td align="left"><img src="' . $dir . $row['naam'] . '" width="50" height="50" onClick="maximize(\'' .$row['naam']. '\')" style="border: 1px dashed white;" align="left" /></td>';
$teller = $teller + 1;
}
?>
this is the javascript function maximize:
<script language="javascript">
function maximize(naam) {
alert("naam = " +naam);
window.location = 'http://example.com/view_image.php?name='+naam;
}
</script>
and this is view_image.php which is called from the javascript function to show the image in its original format in <td> when clicked on the thumbnail:
<?php
ob_start();
if(isset($_GET['name'])) {
header("Content-type: image/jpeg");
header('location:http://example.com/index.php?page=images/albums/brasschaat/' . $_GET['name'] . '.jpg');
}
else
{
echo 'error';
}
?>
this has as a result that the image is shown in <td> as i wished, but in text format and not in image format.
can anyone help me to show the image in image format in the <td>?
grtz kristof
[edited by: ergophobe at 8:34 pm (utc) on Oct. 27, 2005]
[edit reason] URL exemplified [/edit]