Image slideshow with php and mysql

Hi all

I posted this on another forum but I just wanted to make sure, and also confirm.

Is it possible to do this:
Have a folder setup, for example, /img/r1/
Within that folder will be images in consecutive order.

Then, in my php file, to read those images and display then in a slideshow. However, I will have different php files with different images. For example, I have www.site.com/hey?id=1, is it possible to use this id= and then tell the script to read images from the /r1/ folder, and if I have a page www.site.com/hey?id=5, the script will read images from /r5/ folder?

Thanks.

Then, in my php file, to read those images and display then in a slideshow. However, I will have different php files with different images. For example, I have www.site.com/hey?id=1, is it possible to use this id= and then tell the script to read images from the /r1/ folder, and if I have a page www.site.com/hey?id=5, the script will read images from /r5/ folder?

Yes use $_GET

If you want an automated sideshow you would probably need to use Javascript - there are a lot of nice jquery ones. You can add the files to the jquery file with php which would be easier than writting each jquery file for each slideshow.

If the slideshow is to be a sort of click on button for next image that could be done with php.

Hi. Are there any detail on $_GET? Also, a reply from anotherforum showed this:

<?php
$allowedFolders =array( ‘r1’,‘r2’,‘r5’ );

if(
!empty( $_GET[‘id’] ) // if the folder I’d is specified
&& in_array( $_GET[‘id’],$allowedFolders ) // and folder is allowed
){
/* get photos /
}else{
/
do default action (e.g., maybe a menu or something) */
}

Would this work like I wanted? because I couldn’t really understand the part to get photos, and what actually

!empty( $_GET[‘id’] ) // if the folder I’d is specified
&& in_array( $_GET[‘id’],$allowedFolders ) // and folder is allowed
does…

$allowedFolders =array( 'r1','r2','r5' );

This is a bit of security to prevent people looking at other folders you do not want them looking into.

Here is a link to GET in the php manual

!empty( $_GET['id'] ) // if the folder I'd is specified
 && in_array( $_GET['id'],$allowedFolders ) // and folder is allowed 

Is checking the folder you are getting the images from is allowed to be accessed.

You need a lot more code than you have posted; as I said that is just a basic bit of security checking.

As I said depending on what you want to do dictates what you do next.

If I was you I would check out some ready made code on Hotscripts.