Picture script

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
thoughtriot
Forum Commoner
Posts: 26
Joined: Thu Nov 07, 2002 9:32 pm

Picture script

Post by thoughtriot »

http://dki.mysundown.net/main.php?z=photos.php

I have this little script I use for making my photograph pages for this site. There's a problem though.

I get the pictures, make thumbnails of all the pictures, then upload the pictures to a separate folder in /pictures/, like for that one group of pictures, they're stored in /pictures/misc2002/. I then have to make a new page to display the pictures on, called misc2002.php in this case. I then use a script so that it automatically resizes the window to the image width when the image is opened, like you see. But the problem is that I have to copy/paste this small part of the script over and over for however many pictures there are in that group, and I also have to rename part of that little script so it matches to the directory that the group of pictures is in. Afterward, this ends up being a big hassle.

Is there anyway to just be able to make a new directory called misc2002, upload the pictures and the thumbnails to it, and have it automatically create a new link like the one that says Miscellaneous | 2002? And then when you click that link, it will open misc2002.php which has all of the thumbnails, which you can click and enlarge like they do?

I'm asking because I know that there are picture gallery scripts where you just upload the thumbs/images to the directory and they're automatically put up on the website. Thanks.
LostSoul
Forum Newbie
Posts: 4
Joined: Sun Dec 15, 2002 7:46 pm

PHP and Images

Post by LostSoul »

thoughtriot: There are a lot of ways to tackle this one. First off most PHP installs are compiled with the GD library available for image manipulation. Resizing images on the fly is one thing you can do with PHP. If you intend to maintain your galleries by using directories for each gallery you can have one script read the directory names and present them as gallery names that are links, gallery.php?dir=misc+2002 When the user hits the link it will run a script that will read the file names in directory "misc 2002" and present the images as thumbnail size images. And then just have the thumbnail image as a link to the file name read into the script earlier. Know that the GD library only works with jpeg and png, no gifs (due to licensing issues).
You could also upload the images as binary data into a MySQL database and retrieve it from there. That way you can set up larger gallery names and add descriptions to both the gallery and the images. A good example you can look at is at http://geek247.net/gallery/ the script is free and pretty straight forward. Look through the code and take what you need.
Post Reply