Results 1 to 4 of 4

Thread: Need Image Count Script!

  1. #1
    Join Date
    Oct 2006
    Posts
    22
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Need Image Count Script!

    1) Script Title: CSS Image Gallery

    2) Script URL (on DD): http://www.dynamicdrive.com/style/cs...-gallery/P100/

    3) Describe problem: I don't really have any problem with this script but.. is there a way to scan a folder.. to display how much images is in a folder?
    i saw something on..http://www.stadtaus.com/demos/gallery_script_en/?6
    but i tried to extract the code from it but it was very confusing.. can you help me anyone ..
    can you give me the code all on one page. thanx
    I would really appericate it.. Thank You
    I own http://www.blastup.com

    Cheng

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    That (from stadtaus.com) is a PHP script and is very similar to the PHP aided javascript here on Dynamic Drive:

    http://www.dynamicdrive.com/dynamici...photoalbum.htm

    I'm not real strong in PHP but, there would have to be a way of integrating it directly with the CSS Gallery you seem to favor. To integrate using javascript as an interface would also be possible and perhaps preferable due to the major difference between the pure PHP version and DD's PHP aided version - page loads.

    Have a look at the above linked DD script and see if it will either suit your purposes as is, or gives you enough to go on to integrate the PHP into whatever other code you wish to use it with. Hint: the real nuts and bolts of gathering the images is the getpics.php file.

    Very Important!! - Just in case you don't know, PHP is a server side language and so will only work on the server (online, on the web) and only if it is available on the server where your page is hosted.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Look at scandir() on the online php.net documentation. (http://php.net/)
    - Mike

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    here...
    PHP Code:
    <?php
    if ($handle opendir('.')) {
       while (
    false !== ($file readdir($handle))) {
           if (
    $file != "." && $file != "..") {
               
    $imgsize = @getimagesize($file);
               if((
    $imgsize[2] > && $imgsize[2] < 4) || $imgsize[2] == 6) {
                 
    $numimgs++;
               }
           }
       }
       
    closedir($handle);
    }
    echo 
    $numimgs;
    ?>
    Last edited by djr33; 01-08-2007 at 05:20 AM.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

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