trying to create thumbnail gallery.....plz hlp

images php coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 6
Joined: Wed Apr 02, 2003 4:27 am

Thu Apr 03, 2003 1:49 am

ok, im just trying to create a thumbnail gallery really.
Im trying to get it working with one image first,

I have set up a db called "Kriminalyouth"
it has two tables "thumbnails" and "Images"

images contains = Picture_ID, Picture_Area, Picture_Path
thumbnails contains = Thum_ID, Thum_Area, Thum_Path

I have set up an images and thums folder in "htdocs" with one image in each. Vase.jpg in images and vasethum.jpg in thums.

Basically im not really sure where to start with the code to make this thumbnail work.

I would really appreciate some ideas, and anny still learning.
Many Thanks People.


New php-forum User
New php-forum User
Posts: 6
Joined: Wed Apr 02, 2003 4:27 am

Thu Apr 03, 2003 2:00 am

just some extra stuff.

Picture_id and thum_id are primary keys.

picture_path = "C:\Program Files\Apache Group\Apache\htdocs\images\vase.jpg"

is that right for now?

could someone do a bit of code possibly?
I have no idea where to start.

User avatar
Posts: 826
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Thu Apr 03, 2003 4:47 pm

you do not want to have the FULL path. People cannot use that via the web. You need the path as it would appear from the web. i.e. images/vase.jpg and forget the rest.

Becasue both the Picture_id and the Thumb_id may not always be the same you will need to add a foreign key in one or each of the tables to reference what Thumb_id goes with which Picture_id.

images contains = Picture_ID, Thum_ID, Picture_Area, Picture_Path
thumbnails contains = Thum_ID, Picture_ID, Thum_Area, Thum_Path

so if you want to get a list of thumnails and want it to create a link to display the full picture you would use this code.

Code: Select all

$query = 'select thumbnails.Thum_Path, images.Picture_Path  from thumbnails, images where images.Picture_ID = thumbnails.Picture_ID';
$result = mysql_query($query);
while($row = mysql_fetch_array($result))

echo '<a href="'.$row['Picture_Path'].'"><img src="'.$row['Thum_Path'].'" border="0"></a><br>';

It's pretty simple code. Hope it helps a lil


Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest