// spradzamy czy mamy konfig
if(is_file('config.cfg.php'))
require 'config.cfg.php';
else
die('Error, no config file');
//sprawdzamy czy mamy katalog ze zdjeciami
if(!is_dir($_images_dir_))
die('Error, no image directory');
?>
stupid
$time_start = microtime(true);
//liczymy zdjecia (jpg i gif)
$noimage = 0;
if ($dh = opendir($_images_dir_)) {
while (($f = readdir($dh)) !== false) {
if((substr(strtolower($f),-3) == 'jpg') || (substr(strtolower($f),-3) == 'jpg'))
{
$imageinfo = getimagesize($_images_dir_.$f);
$width = $imageinfo[0];
$height = $imageinfo[1];
$size = round(filesize($_images_dir_.$f)/1024,1).' KB';
$noimage++;
$images[] = array('filename' => $f, 'width' => $width, 'height' => $height, 'size' => $size);
array_multisort($images, $_sort_, SORT_REGULAR);
}
}
closedir($dh);
}
if($noimage)
{
if($_GET["img"] != '')
{
echo ''.$images[$_GET["img"]][filename].'
';
if($images[$_GET["img"]][filename] != '')
{
if($_GET["img"])
$_no_ = ceil(($_GET["img"]+1)/$_no_pics_per_page_);
else
$_no_ = 1;
if($_GET["img"] == 0)
$side = 'up next >>
';
elseif($_GET["img"] == ($noimage-1))
$side = '<< prev up
';
else
$side = '<< prev up next >>
';
echo $side.'
'.$side;
}
}
else
{
echo ''.$_page_title_.'
';
// echo $noimage.' '.print_r($images);
if($noimage > $_no_pics_per_page_)
$norows = ceil($_no_pics_per_page_/$_no_cols_);
else
$norows = ceil($noimage/$_no_cols_);
$nopos = ceil($noimage/$_no_pics_per_page_);
// echo $nopos;
echo '
';
if($_GET["no"] == "")
$no = 1;
else
$no = $_GET["no"];
$index=abs($no-1)*$_no_pics_per_page_;
if(($noimage-$index)<$_no_pics_per_page_)
$norows= ceil(($noimage-$index)/$_no_cols_);
for($a = 1;$a<=$norows;$a++)
{
echo '
';
for($b = 1;$b<=$_no_cols_;$b++)
{
if($images[$index][filename] != '')
{
echo '
';
if($_filename_)
echo ''.$images[$index][filename].' ';
echo ' ';
$index++;
}
else
echo ' ';
}
echo '
';
}
echo '
';
if($nopos>1)
{
echo '';
for($i=1;$i<=$nopos;$i++)
{
if($i == $no)
echo ''.$i.' ';
else
echo ''.$i.' ';
}
echo '
';
}
}
}
else
die('No images in directory');
$time_end = microtime(true);
$time = $time_end - $time_start;
echo ' All images in gallery : '.count($images).' Created by QuickGallery
';
?>