FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


PHP(+MySQL) photo gallery





bnbrown
I have some 20 pictures. I want only one page that opens the picture. Now it works just having each picture an individual page and it's linked. So it would be nice to have just one page instead and php the pictures from that page. Can anyone help how?
AftershockVibe
You could try PHP Photo Album. Have a look;
http://www.stoverud.com/PHPhotoalbum/

It's not massive on features but should have everything you need for a small collection of pictures. I think you can disable comments if you wish to.
bnbrown
Thanks first off. But I'd like to do it myself as I already php a bit. It couldn't be so hard but I don't know how to start.
AftershockVibe
Oh, I see. Well from your description I'm not entirely sure what you want to do but I'll see what I can do....

You want one page which opens a specified picture? So instead of creating a whole new page you just need to amend the link.

You don't want:
photo1.php
photo2.php
photo3.php
...etc

You'd rather have
photo.php?pid=1
photo.php?pid=2
photo.php?pid=3
..etc

Now, the level of complexity for this sort of thing can vary immensely depending on how abstracted you want it to be from the users. The simplest way is to do something like the following:

1.) Stick all the photos in a folder ("images") and label them numerically ("1 .jpg", "2.jpg" etc)
2.) Use a passed GET variable in the URL to specify the image ("pid" as above)
3.) Stick the following code in "photo.php" (or whatever you decide to call it).
Code:
<img src="images/" . $_GET['pid'] . ".jpg">

4.) Pad out as necessary with your layout.

That should get you started at least
Cool
bnbrown
Hey I just making what you said. I think you got hte solutuion but I can't make it up.
Code:
<a href="../images/" . $_GET['pid'] . ".jpg"><img src="/4a/1s.jpg" class="photos" alt="1" title="1" border="0"></a>
<a href="photos.php?pid=2" class="photos"><img src="/4a/2s.jpg" class="photos" alt="2" title="2" border="0"></a>


This is my code, but I think it's good.

And this is the site I work on http://lookingdoor.net/en/photos.php

the first 2 images are the test agents and also are in the code above
Related topics
PHP, MySQL...
Photo Gallery with Thumbnails
My photo gallery (warning: boring and big files)
Web Photo Gallery, Very Easy
ASP +PHP+MySQL Tutorials
what is your php mysql apache installer package
Need some php/mysql dlls
The Basics (php, mysql etc)
What is useful way in this php+mysql problem?
the best photo gallery around?
PHP/Mysql - beginner!
Looking for someone to install photo gallery script Please
Help with embedded Flash photo gallery
Looking for a photo gallery...
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.