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

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

0 Members and 2 Guests are viewing this topic.

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #75 on: October 16, 2002, 12:09:23 AM »
Quote from: Michi
Kann sich einer Vorstellen, was ich hier falsch gemacht habe ?

http://www.badboys.ch/4images/random.php

da kommt einfach kein Bild !

Obwohl der Pfad stimmt !


Gruss

Michi


es wird nie eins kommen, wennst, nur für registrierte benützen den klick auf thumbs erlauben tust..
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 Michi

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #76 on: October 16, 2002, 01:51:19 PM »
So nun hat es geklappt  :D

Ich habe hier eine Kopie von meiner random.php


Die gehört in ein unterverzeichnis ./4images/nuke

Quote


<body bgcolor="E5E5E5">   <--- hier wird die Seiten Farbe bestimmt !
<?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', '../../4images/');
define('SCRIPT_URL', 'http://www.deine Domain.de/4images/');



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

?>



Dann noch einen Auszug den ich mit einem Iframe gemacht habe ! ( für das Portal )

Quote


<body bgcolor="#E5E5E5">
<p align="center">
<iframe name="I1" scrolling="no" align="middle" border="0" frameborder="0" src="http://www.deine Domain.de/4images/nuke/random.php" width="133" height="127">
Ihr Browser unterstützt Inlineframes nicht oder zeigt sie in der derzeitigen Konfiguration nicht an.
</iframe></p>



So ... nun danke ich allen die mir geholfen haben ?

Gruss

Michi

Offline Michi

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #77 on: October 16, 2002, 05:00:37 PM »
Cool  :oops:

Es funktioniert nun alles !

Danke

Offline Michi

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #78 on: October 17, 2002, 09:44:36 AM »
Ich hoffe es kann mir jemand helfen ....

Weil sonst die Gallery garnicht zur geltung kommt !

Gruss

Michi

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #79 on: October 17, 2002, 02:56:44 PM »
wie bereits gesagt, wennst auf die thumbs nicht klicken kannst, wirds nicht funktionieren..

aber probiere mal dies:

in beiden queries
Code: [Select]

AND b.auth_viewimage=".AUTH_ALL."

auf
Code: [Select]

AND b.auth_viewimage=2

ändern..
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 Michi

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #80 on: October 17, 2002, 06:00:46 PM »
Jep ... die random.php Seite funktioniert jetzt ...

Was muss ich denn nun machen das ich die in eine Andere PHP seite als Link einfügen kann ...

So das man das Bild auf der anderen PHP -Seite sieht `?

Wie gebe ich den das die Verknüpfung an ... ???

Gruss und besten Dank


Michi

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #81 on: October 18, 2002, 03:52:09 PM »
das hätten wir schon einige male besprochen...

lese diesen thread von anfang an...
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 hoelzlmani

  • Newbie
  • *
  • Posts: 24
    • View Profile
    • http://www.smssprueche.net
Re: [Mod] Random image / Zufallsbild
« Reply #82 on: October 21, 2002, 01:24:19 PM »
Quote from: Jan
Put this in the two queries:
Code: [Select]
AND a.cat_id IN (4, 9, 15)
Greets Jan


ähm, wo ist das genau zum einfügen, was ist mit two queries gemeint?

Offline Andre

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #83 on: October 21, 2002, 06:55:10 PM »
Hallo

bekomme immer nur diese Fehlermeldung:

Security violationSecurity violation
Fatal error: Cannot instantiate non-existent class: db in /home/www/web232/html/4images/random.php on line 34

Warum hat das Skript denn Probleme mit der DB zu komunizieren?

Der Pfad wo 4images und alle Daten liegen ist eigentlich ok.

Grüsse

Andrè

Offline BevS97

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #84 on: October 27, 2002, 02:43:54 AM »
am trying to use this mod - I am very new to PHP so am probably doing something very stupid...

I have installed the random.php and it is working
http://www.ukscrappers.co.uk/gallery/random.php

however,  when I try and include this into HTML I just get a blank screen.
my test page is http://www.ukscrappers.co.uk/phptest.htm
the code for this is
Quote

<html>
 <head>
  <title>random image Test</title>
 </head>
 <body>
<?php
include("../random.php");
?>
 </body>
</html>


and random.php looks like this
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', '../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;
}

$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'] : 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=\"0\" alt=\"$image_name\"></a><br>\n";
echo "<b>$image_name</b><br>\n";
echo "Comments: $image_comments<br>\n";
?>

random.php is in both the root directory and the gallery directory as I wasnt' sure which was correct.

I'm sorry if this has already been covered in this thread - my German is very poor.

Vielen Dank

Bev

Offline Nicky

  • Administrator
  • 4images Guru
  • *****
  • Posts: 3.195
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #85 on: October 29, 2002, 07:36:22 AM »
@BevS97,

you can't use php inludes into HTML files ;)
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 BevS97

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #86 on: October 29, 2002, 10:17:36 AM »
just to add for anyone else struggling with this.
You can mix html and php but you have to rename the file to end in .php and then it all works fine.

bev

Offline Matthias70

  • Full Member
  • ***
  • Posts: 199
    • View Profile
    • Bildergalerie
Re: [Mod] Random image / Zufallsbild
« Reply #87 on: November 02, 2002, 06:55:23 PM »
Hallo zusammen,
wie kann ich denn in der random.php die Anzahl der Aufrufe (Hits) einfügen. Bisher ist nur der Name des Bildes und die Anzahl der Kommentare zu sehen.

viele Grüße
Matthias

www.gpaed.de

Offline BevS97

  • Newbie
  • *
  • Posts: 28
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #88 on: November 03, 2002, 07:13:43 PM »
Assuming you want to change what is displayed along with the thumbnail,  you need to look in the themes directory.  there is a file called thumbnail_bit

you need to change that - or copy it and point to the new file in random.php

Offline Matthias70

  • Full Member
  • ***
  • Posts: 199
    • View Profile
    • Bildergalerie
Re: [Mod] Random image / Zufallsbild
« Reply #89 on: November 03, 2002, 07:31:02 PM »
Hier ein Versuch die random.php mit Hits und Bewertung zu ergänzen.
Funktioniert nicht ;-(

Code: [Select]
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];
$image_hits = $row['image_hits'];
$image_rating = $row['image_rating'];
$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=\"0\" alt=\"$image_name\"></a><br>\n";
echo "<b>$image_name</b><br>\n";
echo "Comments: $image_comments<br>\n";
echo "Hits: $image_hits<br>\n";
echo "Bewertung: $image_rating<br>\n";
?>


Wer hat einen Lösungsvorschlag?
Matthias