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

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

0 Members and 1 Guest are viewing this topic.

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #90 on: November 04, 2002, 02:55:21 PM »
naja, musst auch die $sql query ergänzen..
SQL SELECT .....
cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi

Offline Matthias70

  • Full Member
  • ***
  • Posts: 199
    • View Profile
    • Bildergalerie
Re: [Mod] Random image / Zufallsbild
« Reply #91 on: November 04, 2002, 05:38:49 PM »
Danke für den Tipp, jetzt läufts.
viele Grüße
Matthias

www.gpaed.de

Offline malavolta_m

  • Pre-Newbie
  • Posts: 5
    • View Profile
    • http://www.milo.tzo.com
Re: [Mod] Random image / Zufallsbild
« Reply #92 on: November 08, 2002, 04:29:37 PM »
Now the randome image works, but at the first button block it gave me this error and it stops loading the page.


Fatal error: Call to a member function on a non-object in D:\milo\nuke\includes\blocks\button.php on line 53


Does enyone know what can be? and how to resolve the problem?

Offline Bärbel

  • Pre-Newbie
  • Posts: 4
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #93 on: November 19, 2002, 05:00:14 PM »
Hallo!

Ich habe [Mod] Random image / Zufallsbild ausprobiert und es funktioniert nur auf der index.php: http://www.strodthoff-online.de/abi91/index.php
Auf den folgenden Seiten verliert das Image den Pfad und wird nicht mehr angezeigt.

Folgendes habe ich verwendet:
Code: [Select]
define('SCRIPT_URL', 'http://www.brinkmann-online.de/umleitung/4images/');
und
Code: [Select]
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : SCRIPT_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

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

aber dann bekomme ich folgende Db-Errors:
DB Error: Bad SQL Query: 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
Table 'DB41221.IMAGES_TABLE' doesn't exist

DB Error: Bad SQL Query: 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 0, 1
Table 'DB41221.IMAGES_TABLE' doesn't exist

Kann das wieder an meine DB von Strato liegen, denn die Tabellen sind doch vorhanden!

Vielen Dank im voraus! Kompliment an den Forum-Moderator, der immer suuuper schnell und gut antwortet!!!

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Re: [Mod] Random image / Zufallsbild
« Reply #94 on: November 19, 2002, 05:12:48 PM »
Die Datei "includes/constants.php" wird bei Dir scheinbar nicht richtig included.
Überprüfe mal diese Zeile
Code: [Select]
include(ROOT_PATH.'includes/constants.php');
Probiere es zur Not mal mit einem absoluten Pfad auf die constants.php
Code: [Select]
include('/absoluter/pfad/zu/includes/constants.php');
Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline Bärbel

  • Pre-Newbie
  • Posts: 4
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #95 on: November 19, 2002, 09:54:54 PM »
Mit
Code: [Select]
include(ROOT_PATH.'includes/constants.php'); und auch mit dem absoluten Pfad klappt es nicht.
Nur in der index.php funktioniert es. Habe ich vielleicht im header selbst nicht richtig includet (wahrscheinlich Anfängerproblem. aber was soll ich machen?!)?
Code: [Select]

include("/home/strato/www/st/www.strodthoff-online.de/htdocs/abi91/index/random.php")

Ich habe den server path angegeben, weil alles andere nicht richtig funktionierte. Ich dachte, dass kann ja nicht falsch sein.
Helft mir, habe ich irgendwo einen Denkfehler?
In:
http://www.strodthoff-online.de/abi91/index.php
funktionierts in:
http://www.strodthoff-online.de/abi91/4images/index.php nicht!

Ich wäre sehr dankbar für eine Hilfe!!!

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Re: [Mod] Random image / Zufallsbild
« Reply #96 on: November 20, 2002, 10:46:51 AM »
Das Problem dürfte
Code: [Select]
define('ROOT_PATH', './4images/');
sein. Hier gibst Du einen relativen Pfad an der natürlich nur von eine Ordnerebene aus funktioniert.
Du kannst das aber aus der random.php herausziehen. Einfach löschen und die random.php so inlcuden:

Für http://www.strodthoff-online.de/abi91/index.php :
Code: [Select]
define('ROOT_PATH', './4images/');
include("/home/strato/www/st/www.strodthoff-online.de/htdocs/abi91/index/random.php");


Für http://www.strodthoff-online.de/abi91/index.php :
Code: [Select]
define('ROOT_PATH', './');
include("/home/strato/www/st/www.strodthoff-online.de/htdocs/abi91/index/random.php");

Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline Bärbel

  • Pre-Newbie
  • Posts: 4
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #97 on: November 20, 2002, 12:44:23 PM »
Quote from: Jan

Für http://www.strodthoff-online.de/abi91/index.php :
Code: [Select]
define('ROOT_PATH', './4images/');
include("/home/strato/www/st/www.strodthoff-online.de/htdocs/abi91/index/random.php");


Für http://www.strodthoff-online.de/abi91/index.php :
Code: [Select]
define('ROOT_PATH', './');
include("/home/strato/www/st/www.strodthoff-online.de/htdocs/abi91/index/random.php");

Jan

...heißt das, dass ich, da der include-Befehl für die random.php im header liegt, für http://www.strodthoff-online.de/abi91/index.php und http://www.strodthoff-online.de/abi91/4images/index.php zwei verschiedene Header benutzen muß?
Meinst Du bei der zweiten Code-Angabe eigentlich http://www.strodthoff-online.de/abi91/4images/index.php und nicht nochmal http://www.strodthoff-online.de/abi91/index.php?

Ich hoffe Du verstehst mich noch...

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Re: [Mod] Random image / Zufallsbild
« Reply #98 on: November 20, 2002, 12:54:02 PM »
Quote
Meinst Du bei der zweiten Code-Angabe eigentlich http://www.strodthoff-online.de/abi91/4images/index.php und nicht nochmal http://www.strodthoff-online.de/abi91/index.php?

Ja ;)

Also gut, andere Möglichkeit. Definiere für ROOT_PATH den absoluten Pfad in random.php
Code: [Select]
define('ROOT_PATH', '/absoluter/pfad/zu/4images/');
Dann ersetzt Du
Code: [Select]
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
durch
Code: [Select]
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : "http://www.strodthoff-online.de/abi91/4images/".THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
Und
Code: [Select]
echo "<a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
durch
Code: [Select]
echo "<a href=\"http://www.strodthoff-online.de/abi91/4images/details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline Bärbel

  • Pre-Newbie
  • Posts: 4
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #99 on: November 20, 2002, 01:18:34 PM »
Vielen, vielen Dank!!!!!
Es funktioniert!

Offline boxerbay

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #100 on: November 24, 2002, 09:40:15 PM »
Jan can you help me out? I have random image but i want to change the white box to grey behind the images and I want to remove the link from the images.  I used Michi modified random image script.

Jan kann Sie mir heraus helfen?  ich haben gelegentliches Bild, aber ich möchte den weißen Kasten zum Grau hinter den Bildern ändern und ich möchte die Verbindung von den Bildern entfernen.

http://babelfish.altavista.com/tr  

Thanks.
PS: Great Script!!! I plan on sending you a donation as soon as I get all the problems worked out. You deserve it!
Thanks Alex.

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Re: [Mod] Random image / Zufallsbild
« Reply #101 on: November 24, 2002, 09:46:34 PM »
1. Maybe you should change the body color of your iFrame:
Code: [Select]
<body bgcolor="#E5E5E5">
2. Just edit this line:
Code: [Select]
echo "<Center><a href=\"".ROOT_PATH."details.php?image_id=$image_id\" target=\"_top\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a></Center><br>\n"; Maybe this will work for you:
Code: [Select]
echo "<Center><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></Center><br>\n";
Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

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 #102 on: November 26, 2002, 01:50:54 AM »
Is there a way to filter pictures without thumnails? or atleast make the script print media thumnbail. otherwise it shows in source like this:
Code: [Select]
<img src="www.mydomain.com/4images/data/thumnails/3/">
with no file name, that makes broken picture.

P.S. with original script I have limit of one <?php include("random.php"); ?> per page, after second time script calls, the page after that point become blank.
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)

Offline boxerbay

  • Newbie
  • *
  • Posts: 18
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #103 on: November 28, 2002, 12:18:10 AM »
@ Jan - Thanks Jan - that removed the link.  I am still stuck with the white backgraound.  I've tried everything even CSS.  Nothing works.  Here is my code from inside PostWrap:

<html>
<body bgcolor="#e5e5e5">
<p align="center">
<iframe  src="http://www.chphoto.net/chphoto/random.php" name="I1" width="100" marginwidth="0" height="100" marginheight="0" align="middle" scrolling="no" frameborder="0" vspace="0" style="color: grey" border="o" >
</iframe>

<a href="modules.php?op=modload&name=PostWrap&file=index&page=chphoto">CHPHOTO.NET</a>
</p>
</body>
</html>

But I think the color may need to be set in random.php
Here is my code:

<?php
// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH', '../chphoto/');
define('SCRIPT_URL', 'http://www.chphoto.net/chphoto/');

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

$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'];

echo "<Center><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a></Center><br>\n";

?>
Thanks Alex.

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 #104 on: November 28, 2002, 03:17:26 AM »
strange, I just tryed Michi's script, it does change color to grey.
make sure that u add at the top of random.php file
Code: [Select]
<body bgcolor="#e5e5e5">
but there is a disadventage of <iframe>. when u use <iframe>, its like u insert whole new, independent page, so, whatever u setup in <header><body> in the main page it doesnt transfer into <iframe>....
but there is more. when browser see <iframe> tag it's clean the space where that page will be desplayed. so in that moment that part become white and u cant change anything, because browser has not load new page source and it doesnt know yet what color will be in that spot. (style="" in iframe preference will not affect)
and that's actualy what I was talking about in my first reply above ^^^
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)