PHP + Images question

hello visters

i am a php code for showpic i have a problem that in this code witch value we give. the showpic.php page show every picture size same like if i give the value 1024 by 768 in this code the when we open this picture in showpic.php it show's with 1024 by 768 i want to make this code. that this code show defult size of picture

<?
include('dbconnect.php');
$pid = $_GET['pid'];

$query = "SELECT dcount FROM data_count WHERE did = $pid";

$res = mysql_query($query,$dblink) or die(" 1 - Contact with admin.");
if(mysql_num_rows($res)>0)
{
$row = mysql_fetch_row($res);
$dcount = $row[0] + 1;

$query = "UPDATE data_count SET dcount=$dcount WHERE did = $pid";
$res = mysql_query($query,$dblink) or die("2 - Contact with admin.");
}
else
{
$query = "INSERT INTO data_count(did,dcount) VALUES($pid,1)";
$res = mysql_query($query,$dblink) or die("3 - Contact with admin.");
}
mysql_close($dblink);
?>
<html>
<head>
<title>..::Hotwallpapers4u.com::..Latest hollywood bollywood xp 3d wallpaper cartoons nature games sexy hot wallpapers..</title>
<style type="text/css">
<!--
.style1 {color: #FF3300}
-->
</style>
</head>
<body>
<p>
<?
include('showpicadd.html');
?>
</p>
<table>
<tr>
<td>
<?
include('dbconnect.php');
$PicNum = $_GET['pid'];
$result=mysql_query("SELECT pic FROM data WHERE did=$PicNum") or die("Can't perform Query");
$row=mysql_fetch_row($result);
?>
<img src="../../unavailable.html" width="1024" height="768"/>
<?
mysql_close($dblink);
?>
</td>
<td>
</td>
</table>
<table>
<tr>
<td><?
?></td>
</tr>
</table>
</body>
</html>

#464355

If I understand your question correctly, it looks like you're hardcoding in the image height and width, which is why it's always showing 1024*768.

<img src="../../unavailable.html" width="1024" height="768"/>

Try changing it to this:

<img src="../../unavailable.html" width="<? imagesx($row[0]) ?>" height="<? imagesy($row[0]) ?>"/>

This page about PHP Image functions may interest you. The code I provided, if it works at all, is rather unwieldy -- you could clean up your code a little bit.

Good luck!

-NC

#464438

Another way to do it would be to not even specify a height / width, not valid but it still works.

Change this:

<img src="../../unavailable.html" width="1024" height="768"/>

Into this:

<img src="../../unavailable.html"/>

#464468