PDA

View Full Version : Need Image Count Script!



blastup
01-07-2007, 08:25 PM
1) Script Title: CSS Image Gallery

2) Script URL (on DD): http://www.dynamicdrive.com/style/csslibrary/item/css-image-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

jscheuer1
01-07-2007, 10:13 PM
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/dynamicindex4/php-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.

mburt
01-07-2007, 10:29 PM
Look at scandir() on the online php.net documentation. (http://php.net/)

djr33
01-08-2007, 04:59 AM
here...

<?php
if ($handle = opendir('.')) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$imgsize = @getimagesize($file);
if(($imgsize[2] > 0 && $imgsize[2] < 4) || $imgsize[2] == 6) {
$numimgs++;
}
}
}
closedir($handle);
}
echo $numimgs;
?>