try this one
<?php
define('ROOT_PATH', './4images/');
include_once(ROOT_PATH.'config.php');
include_once(ROOT_PATH.'includes/db_mysql.php');
define('PIC_CATEGORIES_TABLE', '4images_categories');
define('PIC_IMAGES_TABLE', '4images_images');
define('AUTH_ALL', 0);
$pics_db = new Db($db_host, $db_user, $db_password, $db_name);
$sql = "SELECT COUNT(*) as total_images FROM ".PIC_IMAGES_TABLE." a, ".PIC_CATEGORIES_TABLE." b WHERE a.image_active=1 AND a.cat_id = b.cat_id AND b.auth_viewcat=".AUTH_ALL." AND b.auth_viewimage=".AUTH_ALL."";
$row = $pics_db->query_firstrow($sql);
$total_images = $row['total_images'];
echo "Total <b>$total_images</b> images in gallery\n";
?>