Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Oct 2008
    Posts
    26
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Paginate images scanned from directory

    Hello there,
    i got this snippet for gettin all images from a directory but, i need to add pagination on it. A simple one, just to not mess up my design if will be found more then X images on the folder.
    Or, if can add a limit for images. To display only XX images randomly, or newest.
    The snippet is this:
    PHP Code:
    $string =array();
    $filePath='images/';  
    $dir opendir($filePath);
    while (
    $file readdir($dir)) { 
       if (
    preg_match('/.jpg/i'$file) || preg_match('/.gif/i'$file) || preg_match('/.png/i'$file)) { 
       
    $string[] = $file;
       }
    }
    while (
    sizeof($string) != 0){
      
    $img array_pop($string);
      echo 
    "<a class='lightbox-image' style='margin-bottom:5px;' href=".$filePath.$img." data-gal='prettyPhoto[gallery2]'>
            <img src="
    .$filePath.$img." width='150' height='100'>
            </a>
            "
    ;
      

    Thank you in advance!

  • #2
    Regular Coder
    Join Date
    Apr 2004
    Posts
    298
    Thanks
    0
    Thanked 23 Times in 23 Posts

  • #3
    New Coder
    Join Date
    Oct 2008
    Posts
    26
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by litebearer View Post
    Thank you for your reply but, i have a paginations script that works with database, getts rows from db and show only some of them. What i need is a pagination script to work with the script submited at the first post.
    I'm not a pro on php so, sorry for my noob questions


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •