I have a php gallery that automatically creates thumbnails via GD. I have attached the php file within a zip file.
What I would like to have help with is I'm not sure how to add pagination to it. I'd like only 6 thumbnails to show up per page and have a type of navigation to go through the pages for a particular album.
you have to select the appropriate images from db of elsewhere
for db you use - LIMIT from,to (WHERE 1 LIMIT 150,156)
will show you 6 images on page 26 (156/6)
The thing is -- this script doesn't use a database -- I know how to do it if there was, but I'm building a website for a friend and their host allows php code but no database..
Get the total amount of images divided by amount per page, in your case 6 this gives us the total number of "pages". (Use ceil())
Use a $_GET variable to store the current page number, we will call this $_GET["page"], default is 0.
Then simple build a sorted array of all the images in a folder and array_shift() 6 * $_GET["page"] images before displaying the final 6 images you want to display.
Originally Posted by temp.user123
You know... You're not so smart. Do you need me to educate you?
If you say, "please," (and do so, nicely) then I will show you where you're dead wrong.
I bet if she knows how to use limit she would deal with GET parameters.
Where do you store your images ?
In a folder getting them into array by readdir ?
You should sort you array by file's creation time back to front to ensure you have the latest newest images on the first page. use multisort and filectime
Then you just output them even not in cycle
< img src='createthubnail.php?img=".( intval($_GET['s']) + 1) ."'>
..
< img src='createthubnail.php?img=".( intval($_GET['s']) + 6) ."'>
Bookmarks