Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

thumbnail help please.

General discussions related to php

Moderators: macek, egami, gesf

thumbnail help please.

Postby gat » Mon Apr 07, 2003 1:50 am

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??????
gat
New php-forum User
New php-forum User
 
Posts: 6
Joined: Wed Apr 02, 2003 4:27 am

Postby pootergeist » Mon Apr 07, 2003 4:22 am

Code: Select all
{
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']. "'");
pootergeist
New php-forum User
New php-forum User
 
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK


Return to PHP General

Who is online

Users browsing this forum: Bing [Bot], Yahoo [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.