4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: Holger2 on September 25, 2008, 01:19:35 PM
-
Hi!
I would like to show the newest pics thumbnails on another, external site.
Is that possible?
I could not find any related topic when searching for this.
/Holger
-
Hi,
Here is a code .. to get more random images outside the gallery. ( copyright of this script still belongs to original author.. :) unfortunately I have forgotten the original Author's name..)
<?php
/**************************************************************************
* *
* 4images - A Web Based Image Gallery Management System *
* ---------------------------------------------------------------- *
* *
* File: random_more_pics.php *
* Copyright: (C) 2002 Jan Sorgalla *
* Email: jan@4homepages.de *
* Web: http://www.4homepages.de *
* Scriptversion: 1.0 for 4images 1.6.1 *
* *
* Never released without support from: Nicky (http://www.nicky.net) *
* *
**************************************************************************
* *
* Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz- *
* bedingungen (http://www.4homepages.de/4images/lizenz.php) für *
* weitere Informationen. *
* --------------------------------------------------------------- *
* This script is NOT freeware! Please read the Copyright Notice *
* (http://www.4homepages.de/4images/lizenz_e.php) for further *
* information. *
* *
*************************************************************************/
// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH', './');
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;
}
// NUMBER OF THUMBNAILS TO DISPLAY / NUMMER DER GEWÜNSCHTEN THUMBNAILS
$num_images = 4;
$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments
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_id 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'];
$image_comments = $row['image_comments'];
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
echo " <a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"1\" alt=\"$image_name\"></a> ";
echo "<b>$image_name</b>\n";
echo "Comments: $image_comments<hr>\n";
}
?>
I think .. you can use this to get the new images thumbnail in external sites.
You can save it in your server and use that link in other websites.
Hope this helps...
-
changing
ORDER BY a.image_id DESC
to
ORDER BY a.image_date DESC
should show the latest images.
-
Great! I will check this out!
V@no: isn't highest ID = newest pic?
-
hi,
DESC is highest ID number = last images
-
V@no: isn't highest ID = newest pic?
Image ID means last added image and not necessarily means newest image, because date is what makes an image new or old ;)
-
It works great except one condition which I couldnt find a solution to anywhere.
I need to show the new images in the details page. i.e., details.html in the template.
when i use the new images script in this post inside details.html i get the following error:
Fatal error: Cannot redeclare is_remote() (previously declared in /home/webbug/public_html/v2/photos/includes/functions.php:118) in /home/webbug/public_html/v2/photos/test-new.php on line 37
-
You'll need use code started with:
// NUMBER OF THUMBNAILS TO DISPLAY / NUMMER DER GEWÜNSCHTEN THUMBNAILS
-
You'll need use code started with:
// NUMBER OF THUMBNAILS TO DISPLAY / NUMMER DER GEWÜNSCHTEN THUMBNAILS
You are right! but the only draw back with this code is that you cant specify the number of column you want like the code here:
http://www.4homepages.de/forum/index.php?topic=21956.0
Now I'm really confused! the first code works perfect inside details.html but can't identify the column number whilest the other code have alot of customization but couldnt make it work inside the details.html.
Your kind support again is requested please.
-
Hi,
I just use this script , working but how can i do to open image in new window
Now it opening in same window
Thanks for help.
-
... find ...
<a href=\"".ROOT_PATH."details.php?image_id=$image_id\">
... and replace with ...
<a href=\"".ROOT_PATH."details.php?image_id=$image_id\" target=\"_blank\">
-
Hi,
Thanks " mawenzi " works fine.
And I have one more question. It's possible instead of latest image to show RANDOM image
Thanks again
-
... find ...
ORDER BY a.image_id DESC
... and replace with ...
ORDER BY RAND()
-
Thank you, Thank you.