thumbnail help please.

A

Anonymous

Guest
right, this is a working bit of code that displays a thumbnail image from a path in mysql.

*****************************
<?php
$conn= @mysql_connect("localhost","gworsnup","bracknell")
or die("Err:Conn");

$rs= @mysql_select_db("kriminalyouth", $conn)
or die("Err:Db");

$query = mysql_query("SELECT * FROM images ");

while ($result = mysql_fetch_array($query))
{
echo "<a href=\"".$result['pic_path']."\">
<img src=\"".$result['thum_path']."\"></a><br>";
}
?>
******************************
It works fine. But brings the main image up in a blank explorer window.

I want the image to be displayed in a designated page called "display.php or html" so that i can also display other info about the image like size, etc.

Please could you start me on my way??????
 
Code:
{
echo '<a href="display.php?img_path=' .$result['pic_path']. '"><img src="' .$result['thum_path']. '"></a><br />
';
}

now the link will point to display.php?img_path=/whatever/image.jpg

so you can write display.php to use the $_GET['img_path'] variable for displaying the right one.

note: because you want display.php to show extra info about the image (which I presume will use another mysql query) you'd probably do best to pass the database image_id value rather than path. display.php?img_ref=' .$result['image_id']. '"
then just query for that id within display.php and use the info returned
$quiz = mysql_query("SELECT * FROM `images` WHERE image_id='" .$_GET['img_ref']. "'");
 
Back
Top