BrainSmasher Posted November 21, 2006 Share Posted November 21, 2006 I need a script that displays smaller version of pictures out of a directory on the page and creates more pages where there are more then 16 images in there (so 16 images per page). There need to be an option to delete images by a delete this image link.How can i do this or where can i find examples Link to comment Share on other sites More sharing options...
justsomeguy Posted November 21, 2006 Share Posted November 21, 2006 Do you want help writing this, or are you just looking for a prebuilt script to do it? Link to comment Share on other sites More sharing options...
BrainSmasher Posted November 21, 2006 Author Share Posted November 21, 2006 Only thing i need to know is how to get the images, and then how to display only 16 per page...The rest i can write myself Link to comment Share on other sites More sharing options...
justsomeguy Posted November 22, 2006 Share Posted November 22, 2006 This will store a list of all of the files in a directory in an array structure: $files = array();$dir = "/tmp";$dh = opendir($dir);while (false !== ($filename = readdir($dh))) { if (!is_dir($filename)) $files[] = $filename;}closedir($dh); To display 16 per page, you will want to use the querystring to send information about what page you are on. The URL would look something like this:images.php?page=3Some code like this would get that value: $page = intval($_GET['page']);if ($page < 1) $page = 1;for ($i = ($page - 1) * 16; $i < ($page * 16) && $i < count($files); $i++){ echo $files[$i];} Link to comment Share on other sites More sharing options...
BrainSmasher Posted November 23, 2006 Author Share Posted November 23, 2006 nvm Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now