maybe an idea ... I have installed the integration in html page ( who display the last ten pix).
here the source of the file latest.php, :
<?php
define('ROOT_PATH', './annonces/');
define('SITE_URL', /');
$db_servertype = "mysql";
$db_host = "xxxx";
$db_name = "xxxx";
$db_user = "xxxx";
$db_password = "xxxx";
$table_prefix = "4images_";
define('4IMAGES_ACTIVE', 1);
include_once('db_mysql.php');
define('PIC_CATEGORIES_TABLE', '4images_categories');
define('PIC_IMAGES_TABLE', '4images_images');
define('THUMB_DIR', 'data/thumbnails');
define('AUTH_ALL', 0);
define('AUTH_USER', 2);
define('AUTH_ACL', 3);
define('AUTH_ADMIN', 9);
$pics_db = new Db($db_host, $db_user, $db_password, $db_name);
function is_remote($file_name) {
return (preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $file_name)) ? 1 : 0;
}
$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'];
$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_date 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." ORDER BY a.image_date DESC LIMIT 3";
$result = $pics_db->query($sql);
while ($row = $pics_db->fetch_array($result)) {
$image_id = $row['image_id'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : SITE_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
echo "<font size=\"1\" face=\"Arial, Helvetica, sans-serif\"><a target=\"a\" href=\"".SITE_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" vspace=\"2\" alt=\"$image_name\"><br>Cliquez sur l'image</a><br>\n";
echo "$image_name<br>\n";
echo "</font>\n";
}
if i add a additional filed ( ex. "promote"), with : 1 for promoting pictures is there a way to use the script to find & display the pictures with promote value=1 ?