how can i use php to automate image display....

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
gloomytree
Forum Newbie
Posts: 2
Joined: Wed Mar 15, 2006 5:18 pm

how can i use php to automate image display....

Post by gloomytree »

So I have an odd question, or who knows, maybe it's normal and I only think it's odd. Oh well, here goes. (and sorry if this is the wrong place to post this question)

I would like to create a website to display images... kind of a like a blog, but with just pictures and no words. Just so you get the picture, basically you would type in http://www.whatever_the_url_is.com for my site, and then all you would see is an image in the center and a title above it (a title for the site, not the specific image). And you would be able to click on that image, and it would open another image in it's place on the same page and you could click on that image, etc. etc. etc.

So, on to my question. Is there any way that I can use PHP to do this semi-automated. I would like to put all of my images in a folder on my server, and then have the php call the most recent image for when you first open the web page. And then if you click on that image, the php would call the next most recent picture in it's place, and ect. ect. That way I wouldn't have to make an html page for every image I upload.

There aren't going to be any next or previous buttons on the page either, if that helps. It will simply be one picture that you can click on that takes you to the next one, as I said above. The only way to get back to the first picture would be to refresh the page.

This is not a commercial site or anything, it's more like a blog--simple and to the point; hence the now navigation buttons.

Is there any way to do this???

Thank you in advance for any answer.

-Cornell
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

this is generally called an image rotator. Basically, when called the script will search a directory (or better yet, call up a list from, say a database to minimize the needs for more checking and date/time control) given a time (supplied through url or current time, if not given) pulls up the first past image.

glob()
getimagesize()
filemtime()
would likely be used.
gloomytree
Forum Newbie
Posts: 2
Joined: Wed Mar 15, 2006 5:18 pm

Post by gloomytree »

I should say that I'm *very* new to php... So, do I need to just figure out how to work those terms you suggested into my php page? Or should I try to find sample php that uses those functions?

In other words.. while those functions do sound like they would do what I want, how do I incorporate them into my page?

Thanks again!!
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

We've had several discussions on various parts of this very recently. You could probably merge the threads' code examples into a start or get a basic idea of how to start it.
Post Reply