4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: seastorm42 on February 20, 2003, 02:04:25 AM

Title: adding last 5 new thumbs from 4images gallery to a MT Blog
Post by: seastorm42 on February 20, 2003, 02:04:25 AM
I'd like any advice anyone has to give about using the following  as a php include to cause a Movable Type blog to show the last 5 new thumbs from a 4images gallery.

Quote
<?php
define('ROOT_PATH', '../gallery/');
include(ROOT_PATH.'config.php');
include(ROOT_PATH.'includes/db_mysql.php');
include(ROOT_PATH.'includes/constants.php');

$site_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;
}

$num_images = 5;

$sql = "SELECT a.image_id, a.image_date, a.cat_id, a.image_name, a.image_active, a.image_thumb_file
FROM ".IMAGES_TABLE." a, ".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 $num_images";
$result = $site_db->query($sql);

while ($row = $site_db->fetch_array($result)){
$image_id = $row['image_id'];
$cat_id = $row['cat_id'];
#$image_name = $row['image_name'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];


echo "<center><table><tr><td width=120 align=center><a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><br/><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br></td><td class=main_td valign=top><b>$image_name</b></td></td></table></center>\n";
}
?>


I installed it on my index.php blog page with an include and it showed the last 5 images wonderfully...  but when i added a new photo to the gallery it didn't show up... I can't figure out why.  

Any ideas?
Title: Well.... still needing help
Post by: seastorm42 on February 20, 2003, 09:02:54 PM
Still having some problems with this little project.  It seems to update on some servers and not others. Not exactly sure...

also when the blog goes to an archive page, it loses the pictures... any php gurus that wish to help would be greatly appreciated!
Title: adding last 5 new thumbs from 4images gallery to a MT Blog
Post by: fabulous on February 27, 2003, 07:58:45 PM
i would also be interested, i just wanted to ask that question myself ;)