• [Mod] Random image / Zufallsbild 5 0 5 1
Currently:  

Author Topic: [Mod] Random image / Zufallsbild  (Read 872657 times)

0 Members and 1 Guest are viewing this topic.

Offline WoD

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #255 on: December 04, 2005, 01:39:45 PM »
Hm, ich teste es nochmal mit einem anderen Browser...

Und ich muss in der random.php wirklich nur den Pfad zu 4images (ist 4images hier gleichbedeutend mit Galerie oder muss ich quasi nach /4iamges/data/... verlinken?) und zum Java Script verlinken?
Keine weiteren Änderungen vornehmen?

Grüße
WoD

Offline weissnix

  • Newbie
  • *
  • Posts: 16
    • View Profile
    • bk-netdicht.de
Re: [Mod] Random image / Zufallsbild
« Reply #256 on: December 04, 2005, 02:00:29 PM »
poste mal deine random.php

Zu welchem JavaScript willst du verlinken? Das ist nur für die Portalbox, damit wird die php aufgerufen.

Offline WoD

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #257 on: December 04, 2005, 04:05:32 PM »
Gut, die Ordnerstruktur auf der Hauptseite meines FTP-Servers sieht wie folgt aus:

->wbblite
->4images

Die random.php habe ich im Ordner 4images.
Die portal.php liegt direkt im wbblite Ordner.

Meine random.php
Quote
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: random.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', 'http://donrenato.funpic.de/4images/');

include(ROOT_PATH.'config.php');
include(ROOT_PATH.'includes/db_mysql.php');
include(ROOT_PATH.'includes/constants.php');
define('SCRIPT_URL', 'http://donrenato.funpic.de/4images/');

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

$sql = "SELECT COUNT(*) as total_images
        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."
        ";
$row = $site_db->query_firstrow($sql);
$total_images = $row['total_images'];

mt_srand((double)microtime() * 1000000);
$number = ($total_images > 1) ? mt_rand(0, $total_images - 1) : 0;

$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."
        LIMIT $number, 1";
$row = $site_db->query_firstrow($sql);
$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'] : SCRIPT_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

print("
document.write('<a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=\"_blank\"><img src=\"".$thumb_src."\" border=\"1\" alt=\"$image_name\"></a>');
");
?>

Hier die Fehlermeldung bei direktem Aufruf der Datei im Browser:
http://donrenato.do.funpic.de/4images/random.php

Offline weissnix

  • Newbie
  • *
  • Posts: 16
    • View Profile
    • bk-netdicht.de
Re: [Mod] Random image / Zufallsbild
« Reply #258 on: December 04, 2005, 04:09:27 PM »
OK, ändere

define('ROOT_PATH', 'http://donrenato.funpic.de/4images/');

in

define('ROOT_PATH', './');

Offline WoD

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #259 on: December 04, 2005, 04:45:05 PM »
Hm, Bilder werden aber noch immer nicht angezeigt, jedenfalls nicht sichtbar *hm*

Klickt einfach mal den Link zur random.php an, da seht ihr sowas "halbes".


Grüße
WoD

Offline weissnix

  • Newbie
  • *
  • Posts: 16
    • View Profile
    • bk-netdicht.de
Re: [Mod] Random image / Zufallsbild
« Reply #260 on: December 04, 2005, 04:46:23 PM »
bei mir kommt bei dem Bild:


404: Die angeforderte Datei ist leider nicht verfügbar!

EDIT: Achso, das verweist auf den /wbblite ordner und nicht in den /4images

http://donrenato.funpic.de/wbblite/data/thumbnails/24/IMG_0445.JPG

Kann es sein das du immer noch eine falsche random.php auf dem server hast?
schick mir doch nochmal die aktuelle random.php.

Offline WoD

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #261 on: December 04, 2005, 05:25:13 PM »
Hm, irgendwiee abenteuerlich, dass ich das nicht auf die Reihe kriege :oops:

Hier meine aktuelle random.php, so wie sie jetzt gerade auf dem ftp-Server liegt:

Quote
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: random.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');
define('SCRIPT_URL', 'http://donrenato.funpic.de/wbblite/');

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

$sql = "SELECT COUNT(*) as total_images
        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."
        ";
$row = $site_db->query_firstrow($sql);
$total_images = $row['total_images'];

mt_srand((double)microtime() * 1000000);
$number = ($total_images > 1) ? mt_rand(0, $total_images - 1) : 0;

$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."
        LIMIT $number, 1";
$row = $site_db->query_firstrow($sql);
$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'] : SCRIPT_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

print("
document.write('<a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=\"_blank\"><img src=\"".$thumb_src."\" border=\"1\" alt=\"$image_name\"></a>');
");
?>

Grüße
WoD

Offline weissnix

  • Newbie
  • *
  • Posts: 16
    • View Profile
    • bk-netdicht.de
Re: [Mod] Random image / Zufallsbild
« Reply #262 on: December 04, 2005, 05:26:27 PM »
aja kein wunder ;)

ändere
Code: [Select]
define('SCRIPT_URL', 'http://donrenato.funpic.de/wbblite/');
in

Code: [Select]
define('SCRIPT_URL', 'http://donrenato.funpic.de/4images/');

Offline WoD

  • Newbie
  • *
  • Posts: 22
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #263 on: December 04, 2005, 06:10:34 PM »
Super!! :D Dankeschön :) Funktioniert jetzt alles 1A *ThumbsUp* :)

Offline EggL

  • Pre-Newbie
  • Posts: 6
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #264 on: December 08, 2005, 12:17:18 AM »
Hi!

Also ich hab auch den "security"-Fehler, möchte jetzt das der Link nichtmehr auf die Galerie zeigt sondern auf das Galerie-Modul selbst...

echo "<a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=\"_top\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";

Wie muss diese Zeile dann heißen ?

Noch besser wäre ja eine Lösung für den Security-Fehler :-(

GreeTzzZ

EggL

Offline weissnix

  • Newbie
  • *
  • Posts: 16
    • View Profile
    • bk-netdicht.de
Re: [Mod] Random image / Zufallsbild
« Reply #265 on: December 08, 2005, 04:28:32 PM »
was meinst du mit galleriemodul?

Gib mal en Link.

Offline Streetwise

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #266 on: December 09, 2005, 04:25:48 PM »
Hello,

Great plugin!

My issue is that the database call needs to be closed in Random.php so that the remaining php includes in my WordPress page work properly.

Currently, I include this code which works great:

<?php include ("random.php"); ?>

Unfortunately, any WordPress includes that come after the above include, try to look up their tables in the gallery database, causing db errors.

The WordPress includes look like this:
<?php wp_list_pages('title_li='); ?>

Error message on the page for this Include is this:

WordPress database error: [Table 'mm_gallery.wp_posts' doesn't exist]
SELECT * FROM wp_posts WHERE post_status = 'static' ORDER BY post_title ASC


I'm too new at this, but what I think needs to be done is to somehow terminate the db connection iin Random.php so that the remaining includes on the page will work.

In Random.php, I've tried adding mysql_close($foobar);  after the three echo lines (66, 67, 68) but nothing happens.
Then, if I remove $foobar from between the parenthesis, the errors go away, but so to any WordPress includes. But the random picture works though!

Next, I tried adding $db->db_close&; in the same location in Random.php, however, that killed the entire remaining page contents after the random.php include!


Not sure what I'm looking for here. Apparently WordPress uses it's own include mechanism which is what's creating some of these issues. I've posted over there about this problem as well, but no on seems to know.

Thanks!


Dom01

  • Guest
Re: [Mod] Random image / Zufallsbild
« Reply #267 on: January 03, 2006, 02:27:18 AM »
Hi Leute,
ich habe eine kleines Problem mit der random.php.
Es hat eigentlich alles Funktioniert.
Nur mir wird kein Bild angezeigt, sondern nur ein Weißes viereck mit einen roten Kreuz drin.
Ich muß dazu sagen, das meine Bilder zwar auf dem gleichen Server liegen, wie das Script, aber nicht im gleichen verzeichnis.
mfg Dom :)


E Hi people,
I have small problem with random.php. It actually functioned everything. Only to me no picture, but only white a square with red cross is indicated in it. I must say to it, who my pictures lie on the same server, like the Script, but not in the same listing.
 mfg Dom :)

Offline CyndiMJJ

  • Pre-Newbie
  • Posts: 8
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #268 on: January 10, 2006, 10:17:27 PM »
I have a question, if I run my 4images program on a subdomain what should I write then?

like this http://gallery.yoursite.com ???

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Random image / Zufallsbild
« Reply #269 on: January 11, 2006, 01:07:20 AM »
As long as your subdomain is pointing to the same server where your 4images is, then you dont need to change anything, just make sure paths within the mod are correct.
If subdomain pointing to a different webserver (computer), then I doubt you can use this mod. You will only be able retrive the image file itself, without any information such as name, category, etc.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)