Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => Images

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

images php coding issues or problems here.

Moderators: macek, egami, gesf

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

Postby gat » 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 help......im still learning.
Many Thanks People.

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

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

Postby Redcircle » 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

}
User avatar
Redcircle
Moderator
Moderator
 
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA


Return to PHP coding => Images

Who is online

Users browsing this forum: No registered users and 1 guest

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

cron