ok, i have a db fed page that displays a piece of text and a thumbnail in a html table.
the images have an onclick javascript event that opens a url and displays a bigger pic.
at the moment i have to specify the size of the new window, which would work just fine with uniform image sizes. The problem is that I would like to use different size images as opposed to a standard size.
Is there a way of dynamically affecting the size of the new window by grabbing the properties of the bigger image eg width and height, and using these values to affect the window size?
Ive guessed that i could create an extra two columns in the db which specified width and height of the images and these would inform the specific hyperlinks created, but ideally id like to grab these via some automatic method as opposed to labourious manual inputs of image width and height attributes.
or am i being overly ambitious? should I just tell the client that their images will need to be of a uniform size?
tia for any suggestions
heres the code
<head>
<?php
// Set the variables for the database access:
$Host = "localhost";
$User = "robert";
$Password = "robert";
$DBName = "village";
$Link = mysql_connect ($Host, $User, $Password);
$Query = "SELECT * from products, categories where products.catid = '$catid' and categories.catid ='$catid' ";
$Result = mysql_db_query ($DBName, $Query, $Link);
$Result2 = mysql_db_query ($DBName, $Query, $Link);
$Row2 = mysql_fetch_array($Result2);
?>
<?
print("<TITLE>Products available in $Row2[catname] section</TITLE>\n");
?>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="vill.css" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" border="0" bordercolor="#330066">
<tr>
<td valign="top">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="50%"><img src="images/newlogo.gif" width="522" height="133"></td>
<td width="50%" valign="bottom">
<div align="right"><img src="images/slantmore.gif" width="152" height="141"></div>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#330099"><img src="images/bluesq.gif" width="10" height="10"></td>
</tr>
</table>
<table width="100%" border="0">
<tr>
<td width="11%" valign="top">
<table width="100%" border="0" cellspacing="2" cellpadding="5">
<tr>
<td><a href="main.htm"><img src="images/aboutbut.gif" width="61" height="63" border="0"></a></td>
</tr>
<tr>
<td><a href="services.htm"><img src="images/servbut.gif" width="78" height="60" border="0"></a></td>
</tr>
<tr>
<td><a href="gifts.htm"><img src="images/giftbut.gif" width="80" height="60" border="0"></a></td>
</tr>
<tr>
<td><a href="location.htm"><img src="images/lobut.gif" width="77" height="60" border="0"></a></td>
</tr>
<tr>
<td><a href="contact.htm"><img src="images/contbut.gif" width="76" height="60" border="0"></a></td>
</tr>
</table>
</td>
<td width="89%" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="422">
<tr>
<td height="44"> <br>
<img src="images/giftbig.gif" width="135" height="37"></td>
</tr>
<tr>
<td >
</td>
</tr>
<tr>
<td class="vp" valign="top">
<script language="JavaScript">
<!--
function openBrWindow(theURL,winName,features) {
window.open(theURL,winName,features);
}
//-->
</script>
<table width="100%">
<tr>
<td>
<?
// Create a table.
print ("<TABLE WIDTH=\"100%\" CELLSPACING=2 CELLPADDING=2 ALIGN=left >\n");
print ("<TR ALIGN=CENTER VALIGN=TOP bgcolor=#330066>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP width=20%><font color=#ffffff>Product Name</font></TD>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP width=40%><font color=#ffffff>Product Description</font></TD>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP><font color=#ffffff>Product Image</font></TD>\n");
print ("<TD ALIGN=CENTER VALIGN=TOP><font color=#ffffff>Prices from</font></TD>\n");
print ("</font></TR>\n");
// Fetch the results from the database.
while ($Row = mysql_fetch_array ($Result)) {
print ("<TR bgcolor=\"#ccccff\" VALIGN=TOP>\n");
print ("<TD VALIGN=TOP><b><font color=#330066> $Row[prodname]</font></b></TD>\n");
print ("<TD VALIGN=TOP>$Row[description]</TD>\n");
print ("<TD VALIGN=TOP align=center>>\n");
print("<a href=\"javascript:;\" onClick=\"openBrWindow('explode.php?productid=$Row[productid]','bigpic','width=500,height=400')\">>\n");
print("<img src=images/$Row[image] width=189 height=130 alt=$Row[prodname] border=0></a></TD>\n");
print ("<TD VALIGN=TOP>£$Row[price]</TD>\n");
print ("</TR>\n");
}
mysql_close ($Link);
print ("</TABLE>\n");
?>
</td>
</tr>
</table>
<table><tr>
<TD><br>
<a href="javascript:;history.back()"><img src="images/backbut.gif" width="66" height="28" border="0"></a>
</td>
</tr></table></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0">
<tr>
<td background="images/gradient.jpg" valign="top">
<div align="center">
<p><img src="images/blurbbott.gif" width="314" height="63"></p>
</div>
<div align="center"></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>