4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: Nicky on July 12, 2002, 10:43:02 AM

Title: [Mod] Random image / Zufallsbild
Post by: Nicky on July 12, 2002, 10:43:02 AM
 :flag-de: hi an alle
 :flag-en: hi all,

 :flag-de: hier ist der Zufallsbild MOD für extra seiten ausserhalb ihrer Gallerie:
 :flag-en: here the Random image MOD for extra sites outside your Gallery:

http://www.nicky.net/4images/random.txt

 :flag-de: speichere den inhalt als random.php
 :flag-en: save the content as random.php

 :flag-de: random.php wurde mit folgenden befehl z.b. in die datei random_mod.php inkludiert
 :flag-en: random.php was included as example into the random_mod.php site with

Code: [Select]
<?php
 
include("./random.php");
?>


 :flag-de: viel spass
 :flag-en: have fun

p.s.:
 :flag-de: vielen dank an JAN der 99% der arbeit geleistet hat ;)
 :flag-en: many thanks to JAN who maked 99% of this mod ;)


# addons for external sites

include thumbail and link on an external site with java script.
http://www.4homepages.de/forum/index.php?topic=1020.msg126303#msg126303

include big image and link on an external site with java script.
http://www.4homepages.de/forum/index.php?topic=1020.msg126326#msg126326
Title: Re: [Mod] Random image / Zufallsbild
Post by: kralle on July 12, 2002, 01:14:57 PM
Hallo Nicky,

Wenn jetzt allerdings jemand so wie ich die Minniatur in einer kleinen Portalbox per i frame anzeigen lässt, und bei einem klick auf das Minniaturbild nicht die ganze Galerie in dieser Box geöffnet haben möchte, der sollte folgenden HTML Code in der random.php ändern.

Suche:

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


Ersetze mit:

Code: [Select]

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



Nun sollte die Galerie auf jeden Fall auf einer eigenen Seite öffnen.


Wer die Galerie im selben Browserfenster wie das Portal anzeigen lassen will, der sollte folgenden Code verwenden:


Code: [Select]

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



l.g.

kralle

PS: Ein fettes DANKE an Nicky
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on July 12, 2002, 01:22:34 PM
*g*

gerne, gerne..

ist ja selbstveständlich..

oder target=\"FrameName\" ;)
Title: Re: [Mod] Random image / Zufallsbild
Post by: Chris on July 12, 2002, 05:12:54 PM
First, thanks to Niky and Jan for this random mod.  It's nice and compact and I think I might use it in other parts of my web site.

But ideally, I'd like to use a random image in a different way.  For my web site home page, I'd like to display a random image.  But instead of displaying the thumbnail and using the random image html template file, I'd like to only display the full image as shown in details.php and I'd like that image to be a link to the details.php page for it.

How would I do this???
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on July 12, 2002, 06:08:10 PM
hi chris,

you mean like that
Title: Re: [Mod] Random image / Zufallsbild
Post by: Chris on July 12, 2002, 06:24:17 PM
Yeah, that's it !

Can you post the code for me?
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on July 12, 2002, 06:29:41 PM
here we go:
http://www.nicky.net/4images/random_full.txt

have fun
Title: Re: [Mod] Random image / Zufallsbild
Post by: dabri on July 12, 2002, 07:22:21 PM
Hallo Nicky,

finde diese Funktion Random Image auf anderen seite prima!

Habe die random.php bei mir installiert und funktioniert auch prima, wenn ich diese Datei direkt aufrufe.

Aber sobald ich die random.php in eine bestehende Seite per:

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

einbinden will, nimmt er immer die relative Adresse vom Thumbnails, von der PHP seite wo ich die random.php include.

Siehe z. B. hier:

http://www.brinkmann-online.de/homepages/bonline/news/news2000.php

In der random.php kann ich im root_path auch keine absolute Adresse eingeben, dann bekomme ich einen Fehler.

Den Link zu details.php habe ich auf der random.php in absolut ändern können, aber nicht zum thumbnail.

Das muss dochirgendwie gehen, ich mach da bestimmt irgendwo einen Fehler?!?

Ich hoffe Du hast mein Kauderwelsch verstanden  :wink:

Gruß Daniel
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on July 12, 2002, 07:39:04 PM
wo befindet sich die random.php ?
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on July 12, 2002, 07:58:47 PM
okay


probier mal das(E: try this)

in der random.php (E: in random.php)
nach (E: after)
Code: [Select]

include(ROOT_PATH.'includes/constants.php');


füge dies ein (E: add this(ofcourse your own url))
Code: [Select]

define('SCRIPT_URL', 'http://www.brinkmann-online.de/umleitung/4images/');


dann ändere (E: change):
Code: [Select]

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


auf (E: to):
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";
Title: Re: [Mod] Random image / Zufallsbild
Post by: dabri on July 12, 2002, 08:13:06 PM
Supi, danke das funktioniert prima!

Das ist hier ein Service - wow!

Nebenbei hab ich wieder mehr erfahren, wie php so finzt

Thx Daniel
Title: Re: [Mod] Random image / Zufallsbild
Post by: timblount on July 12, 2002, 10:28:11 PM
Can I modify this code to select a random image from just one category of my gallery? If so, how?

Thanks,

Tim
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on July 13, 2002, 08:40:03 AM
@timblount
sure!

in the two queries put

Code: [Select]

AND a.cat_id=XXX


XXX = where is your category number
Title: Re: [Mod] Random image / Zufallsbild
Post by: timblount on July 22, 2002, 05:27:32 PM
Hmm I'm not sure what I'm doing wrong.

Here's the code:

$sql = "SELECT COUNT(*) as total_images
        FROM ".IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
        WHERE a.image_active=1
        AND a.cat_id=2
        AND b.auth_viewcat=".AUTH_ALL."
        AND b.auth_viewimage=".AUTH_ALL."<br>
        ";
$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=2
        AND b.auth_viewcat=".AUTH_ALL."
        AND b.auth_viewimage=".AUTH_ALL."<br>
        LIMIT $number, 1";

and here's the error:

DB Error: Bad SQL Query: SELECT COUNT(*) as total_images FROM 4images_images a, 4images_categories b WHERE a.image_active=1 AND a.cat_id=2 AND b.auth_viewcat=0 AND b.auth_viewimage=0<br>
You have an error in your SQL syntax near '' at line 7

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 4images_images a, 4images_categories b WHERE a.image_active=1 AND a.cat_id=2 AND b.auth_viewcat=0 AND b.auth_viewimage=0<br> LIMIT 0, 1
You have an error in your SQL syntax near 'LIMIT 0, 1' at line 7


 :?:

-Tim
Title: Re: [Mod] Random image / Zufallsbild
Post by: Chris on July 22, 2002, 07:38:33 PM
Code: [Select]
$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=2
AND b.auth_viewcat=".AUTH_ALL."
AND b.auth_viewimage=".AUTH_ALL."<br>
LIMIT $number, 1";


I don't think the HTML tag <br> belongs in either of the SQL statements.  Try deleting them or download the script again to use the original source code.
Title: Re: [Mod] Random image / Zufallsbild
Post by: dabri on July 23, 2002, 09:51:24 AM
Ist es möglich das Random Image auf einer CGI-Seite (Gäastebuch) anzuzeigen.

Kann ich da den Include Befehl verwenden oder gibt es da eine andere Lösung?

Gruss Daniel
Title: Re: [Mod] Random image / Zufallsbild
Post by: timblount on July 23, 2002, 05:05:13 PM
Thanks I must have put those in in Dreamweaver somewhere along the line.   :wink:
Title: Re: [Mod] Random image / Zufallsbild
Post by: Jan on July 24, 2002, 07:54:37 AM
@dabri: Nein, geht leider nicht.

Gruß Jan
Title: Re: [Mod] Random image / Zufallsbild
Post by: miro912 on July 25, 2002, 06:14:07 PM
@Jan
ich musste damit ich das Zufallsbild in mein PHPKIT incuden kann, Deinen Code etwas modifiziren, da sich PHPKIT beim includen "fremder" Seiten als sehr zickig erweist. Verstosse ich damit gegen die Lizensbestimmungen oder geht das OK (ich frage aus schlechter Erfahrung herraus). Zu sehen ist ganze auf http://www.mycatsonline.de.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Jan on July 25, 2002, 06:54:08 PM
Alles ok. Ausschnitt aus den Lizenzbestimmungen:

Quote
Der Nutzer von 4images kann auf eigenes Risiko die Software verändern und/oder auf seine Bedürfnisse anpassen.


Gruß Jan
Title: Re: [Mod] Random image / Zufallsbild
Post by: miro912 on July 25, 2002, 07:03:01 PM
@Jan
Danke für die schnelle Antwort  :D
Title: Re: [Mod] Random image / Zufallsbild
Post by: Marquis2000 on July 27, 2002, 05:24:50 PM
Leider geht bei mir der iclude Befehl nicht aber wenn ich die random.php aufrufe funktioniert diese wunderbar. Wenn ich nun den <?php
include("./random.php");
?>  Befehl anwende zeigt er mir auf der jeweiligen Seite nichts an das hab ich schon probiert wenn ich die random.php Datei in den selben Ordner lege oder im Hauptordner nie zeigt er was an:

Also meine komplette Seite liegt zB. im Ordner test/ und die datei random.php im Hauptordner also eine Ebene tiefer dann muesste doch der Pfad so <?php
include("../random.php");
?> aussehen geht aber nicht

Die datei random.php im selben ordner muesste der Pfad so <?php
include("random.php");
?> aussehen geht aber auch nicht WIESO nur ??? Danke an Euch
Title: Re: [Mod] Random image / Zufallsbild
Post by: Marquis2000 on July 27, 2002, 05:42:24 PM
hat sich erledigt geht ja nur in php seiten ;) :oops:
Title: Re: [Mod] Random image / Zufallsbild
Post by: Harry on July 30, 2002, 12:02:16 PM
Hi Nicky & Jan,

I was wondering if there is a possibility to call for x number of random images. It will not work if I just copy the random.php file multiple times

"Cannot redeclare class db in /images/includes/db_mysql.php on line 25"

and

"Cannot redeclare" errors when I copy random.pho and past as random2.php and comment out the includes in random2.php.

Can you help? Would like to display 3 or 4 images from a certain category.

Thanks in advance,
best regards,

Harry
Title: Re: [Mod] Random image / Zufallsbild
Post by: bovkun on August 01, 2002, 01:13:11 PM
Help, please!
How I can include this mod into main page of phpBB? I mean without <IFRAME> (http://prostor.com.ua/forum).

This mod don't work in .TPL (index_body.tpl) :cry:  
Sorry, but I know PHP very good...

How can I resolve this problem?

Thanks!
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on August 01, 2002, 09:37:37 PM
@bovkun,

i saw that you did it ;)
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on August 01, 2002, 10:19:59 PM
@Harry,

here is it:
http://www.nicky.net/4images/random_more_pics.txt

for certain category add this: http://www.4homepages.de/forum/viewtopic.php?p=4360#4360
Title: Re: [Mod] Random image / Zufallsbild
Post by: bovkun on August 02, 2002, 11:11:41 AM
Quote from: Nicky
@bovkun,

i saw that you did it ;)


No. It made with IFRAME, but I don't like it.
How do it without IFRAME?
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on August 02, 2002, 11:23:46 AM
try to put the code anywhere into the phpbb index.php
let me know if this will help..
Title: Re: [Mod] Random image / Zufallsbild
Post by: Harry on August 02, 2002, 03:36:19 PM
Quote from: Nicky
@Harry,

here is it:
http://www.nicky.net/4images/random_more_pics.txt

for certain category add this: http://www.4homepages.de/forum/viewtopic.php?p=4360#4360

Not exactly, but I like it  :wink:

This works for most of my pages, I like that there is little chance of double images.

But on some of my pages I would like to choose from 2 different categories.
If I include like this:
Code: [Select]
<?php include("random_cat1.php"?>
<?php include("random_cat2.php"?>
<?php include("random_cat1.php"?>
<?php include("random_cat2.php"?>
<?php include("random_cat1.php"?>

It works, but chances are high I get double images.

Can I also let the random-more-pics.php file choose from more than one category?

Thanks for your help,
best regards,

Harry
Title: Re: [Mod] Random image / Zufallsbild
Post by: Harry on August 02, 2002, 04:32:16 PM
oh, one more tiny question, how do I define the category name to be used in the caption or alt tag?

Thanks for your help, can't wait to send you guys my first ecard :-)

Harry
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on August 02, 2002, 04:54:15 PM
change line
Code: [Select]

$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments

to
Code: [Select]

$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, b.cat_name

add after
Code: [Select]

  $cat_id = $row['cat_id'];

this
Code: [Select]

  $cat_name = $row['cat_name'];

now you can use  $cat_name in echo..
Title: Re: [Mod] Random image / Zufallsbild
Post by: Harry on August 12, 2002, 11:50:35 AM
Hi Nicky, thanks for all the support, one more question which was not answered before:

How can I choose from more than one category?
I would like to randomize from a category and it's subcategories, so for example cat id = 4 & 9 & 15.

Can this be done?

Thanks,
best regards,
Harry
Title: Re: [Mod] Random image / Zufallsbild
Post by: Jan on August 12, 2002, 12:33:46 PM
Put this in the two queries:
Code: [Select]
AND a.cat_id IN (4, 9, 15)
Greets Jan
Title: Re: [Mod] Random image / Zufallsbild
Post by: Harry on August 12, 2002, 12:56:27 PM
Quote from: Jan
Put this in the two queries:
Code: [Select]
AND a.cat_id IN (4, 9, 15)
Greets Jan


Thx  :)
Title: Re: [Mod] Random image / Zufallsbild
Post by: Big_Fish on August 26, 2002, 02:52:21 PM
Ich krieg immer nur "Security violation"  :?:
Title: Re: [Mod] Random image / Zufallsbild
Post by: Big_Fish on August 26, 2002, 03:07:54 PM
Ähm also das Standard Script geht immer noch nicht aber wenn man das ganze als Bild (image hader bla) ausgibt, gehts?  :?:  :?:  :?:
Title: Re: [Mod] Random image / Zufallsbild
Post by: X-Fan on August 27, 2002, 05:22:26 AM
Okay, I'm lost. :(

What directory does random.php go in?

And what code do you need to put to have this come up on, say, my vBulletin forums main page?  And where do I put the code?
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on August 27, 2002, 06:50:32 PM
Quote from: Big_Fish
Ähm also das Standard Script geht immer noch nicht aber wenn man das ganze als Bild (image hader bla) ausgibt, gehts?  :?:  :?:  :?:


so gemacht wie ich es geschrieben habe ?
oder doch am code herumgefummelt ? ;)
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on August 27, 2002, 06:56:59 PM
Quote from: X-Fan
Okay, I'm lost. :(

What directory does random.php go in?

And what code do you need to put to have this come up on, say, my vBulletin forums main page?  And where do I put the code?


in category where you want..
but i suggest to use SCRIPT_URL..

on your VB, i would try to put it anywhere into "forumhome" template..
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on August 27, 2002, 07:05:56 PM
into template it's not working
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on August 27, 2002, 07:19:17 PM
well, i found something else..

instead off echo output in random.php
you can use this
Code: [Select]

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


and this in your forumhome template
Code: [Select]

<SCRIPT language='JavaScript'  src='http://YOUR_DOMAIN/random.php'></SCRIPT>
Title: Re: [Mod] Random image / Zufallsbild
Post by: Warhead on August 29, 2002, 10:14:13 AM
@BIgFish
Das Problem hatte ich auch, aber wenn du den Pfad zum random.php änderst, dann müsste es gehen!!!

Code: [Select]
// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH', '../images/');


da random.php bei mir in "phpbb2"-ordner liegt, und ich daher ein verzeichnis zurücksetzen musste, habe ich es einfach geändert!
Title: Re: [Mod] Random image / Zufallsbild
Post by: Joe.Emre on August 29, 2002, 04:18:33 PM
Hallo Jan!:)
ich würde gerne seperat ein random script in meine seite einbinden.Es kommt aber immer eine fehlermeldung!wenn ich den code
einbinde!oder muss ich einen html code kopieren?da´wo bilder steht sollte das random script rein!
Code: [Select]
<?php 
include&#40;"./random.php"&#41;; 
?>

http://www.joeemre.de/apportal/
das ist das random script,aber wie bekomme ich es auf meine seite?!
http://www.joeemre.de/random.php
habe schon ne menge gelesen hier, aber ich raff es nicht!


MfG
Joe.Emre
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on August 29, 2002, 05:27:39 PM
wozu doppelter posting ¿ ;)

was für eine fehlermeldung erhälst du ?

oder probiert dieses:
http://www.4homepages.de/forum/viewtopic.php?p=4347#4347
Title: Re: [Mod] Random image / Zufallsbild
Post by: Joe.Emre on August 29, 2002, 05:45:17 PM
Sorry für das doppel poste! :oops: ok ich veruch es mal!




Mfg
Joe.emre
Title: Re: [Mod] Random image / Zufallsbild
Post by: Joe.Emre on August 29, 2002, 06:05:26 PM
kannst du mich mal koriegieren?
 
Code: [Select]
*                                                                        *
 *************************************************************************/

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH', 'http://www.joeemre.de/random.php');

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 "<a href=\"".SCRIPT_URL."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";
?>

Mfg
Joe.Emre
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on August 29, 2002, 06:14:05 PM
ja kann ich ;)

wenn die random.php hier ist:
http://www.joeemre.de/random.php


Code: [Select]

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

define('SCRIPT_URL', 'http://www.joeemre.de/4images/');


und wennst die random.php ind dein apportal integrieren willst
dann ist es:
Code: [Select]

<?php 
include("../random.php"); // .. = verzeichnis höher . = gleicher verzeichnis
?>

Title: Re: [Mod] Random image / Zufallsbild
Post by: Joe.Emre on August 29, 2002, 06:43:58 PM
kannst du mich wieder koriegieren :)
Code: [Select]
*************************************************************************/

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH', './4images/');

define('SCRIPT_URL', 'http://www.joeemre.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 "<a href=\"".SCRIPT_URL."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";
?>

ist das richtig?


Mfg
Joe.Emre
Title: Re: [Mod] Random image / Zufallsbild
Post by: Joe.Emre on August 29, 2002, 07:09:19 PM
schau mal bitte!
http://www.joeemre.de/apportal/


was mache ich falsch? :(




Mfg
Joe.Emre
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on August 29, 2002, 07:15:16 PM
includen mit

../random.php

nicht
./random.php
Title: Re: [Mod] Random image / Zufallsbild
Post by: Joe.Emre on August 29, 2002, 07:43:15 PM
geht nicht!
Code: [Select]
<?php 
include&#40;"../random.php"&#41;; 
?>

hab ich eingegeben aber wenn ich dann auf meine seite geh kommt immer das hier
Code: [Select]
Warning: Unable to access ./random.php in /home/www/htdocs/joeemre.de/apportal/inc/navi_links.inc(36) : eval()'d code on line 88

Warning: Failed opening './random.php' for inclusion (include_path='.:/usr/lib/php') in /home/www/htdocs/joeemre.de/apportal/inc/navi_links.inc(36) : eval()'d code on line 88



Mfg
Joe.Emre


P.S.bitte gib nicht auf mir zu helfen! :wink:
http://www.joeemre.de/apportal/
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on August 29, 2002, 07:51:30 PM
hmmm...

wie schauts mit
<?php
include("../../random.php");
?>
Title: Re: [Mod] Random image / Zufallsbild
Post by: Joe.Emre on August 29, 2002, 08:16:27 PM
ähmmm nein geht auch nicht!  :?
was kann das noch sein?


Mfg
Joe.Emre
Title: Re: [Mod] Random image / Zufallsbild
Post by: Joe.Emre on August 29, 2002, 08:17:32 PM
so wie der code ist einfach kopieren richtig?!
Title: Re: [Mod] Random image / Zufallsbild
Post by: Jan on August 29, 2002, 08:35:38 PM
Wenn ich mich mal kurz einmischen darf. Deine Fehlermeldung sagt, dass Du immer noch
./random.php
drinstehen hast. Es muss aber
../random.php
sein.

Jan
Title: Re: [Mod] Random image / Zufallsbild
Post by: Joe.Emre on August 29, 2002, 08:43:37 PM
jede hilfe ist mir recht Jan!
ich sitze schon fast den ganzen tag drann!also habt ihr icq dann könnt ihr euch mal selber vergewissern!was mich natürlich freuen wird, wenn ich das mal geschaft habe!




Mfg
Joe.Emre


P.S.
habe ich aber so rein kopiert
Code: [Select]
<?php 
include&#40;"../../random.php"&#41;; 
?>


und so ausprobiert
Code: [Select]
<?php 
include("../random.php"); 
?>
Title: Re: [Mod] Random image / Zufallsbild
Post by: Jan on August 29, 2002, 08:46:10 PM
Hier: http://www.4homepages.de/forum/viewtopic.php?p=7012#7012
hast Du behauptet
Code: [Select]
../random.php
genommen zu haben.

Die Fehlermeldung sagt aber, dass Du
Code: [Select]
./random.php
drinstehen hast.
Also, irgendwas machst Du falsch. Kann ja eigentlich nicht so schwer sein ;)

Jan
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on August 29, 2002, 10:41:17 PM
okay..
in der random.php ändere diese zeile:
von
define('ROOT_PATH', './4images/');

auf

define('ROOT_PATH', '../4images/');
Title: Re: [Mod] Random image / Zufallsbild
Post by: Joe.Emre on August 29, 2002, 11:02:13 PM
ohhhhhhhhh man endlich vielen,vielen dank an Nicky und Jan für den echt super tollen suport.
ich kann mich nur vor euch verbeugen ! 8)
jetzt kann ich endlich beruhigt schlafen gehen!






Mfg
Joe.Emre


P.S.ihr seid SPITZE :!:
Title: Re: [Mod] Random image / Zufallsbild
Post by: Murmel on September 03, 2002, 09:45:55 PM
Hi ich bins schon wieder

Ich hab das script auf meiner Seite (http://www.virtualcave1.curvedspaces.com) eingebaut, und auf der Hauptseite sieht es sehr schön aus.

Weil es in meiner Fussdatei ist, habe ich die am Anfang genannten Veränderungen durchgeführt, damit es von überall aus angezeigt wird. Leider klappt das nicht.

Ich erhalte folgende errors sobald ich auf eine andere Unterseite gehe:

Quote

Warning: Unable to access ./4images/config.php in /users/curvedspaces.com/virtualcave1/random.php on line 30

Warning: Failed opening './4images/config.php' for inclusion (include_path='.:/usr/local/lib/php') in /users/curvedspaces.com/virtualcave1/random.php on line 30

Warning: Unable to access ./4images/includes/db_mysql.php in /users/curvedspaces.com/virtualcave1/random.php on line 31

Warning: Failed opening './4images/includes/db_mysql.php' for inclusion (include_path='.:/usr/local/lib/php') in /users/curvedspaces.com/virtualcave1/random.php on line 31

Warning: Unable to access ./4images/includes/constants.php in /users/curvedspaces.com/virtualcave1/random.php on line 32

Warning: Failed opening './4images/includes/constants.php' for inclusion (include_path='.:/usr/local/lib/php') in /users/curvedspaces.com/virtualcave1/random.php on line 32

Fatal error: Cannot instantiate non-existent class: db in /users/curvedspaces.com/virtualcave1/random.php on line 37


Was muss ich ändern? Oder liegt das schon wieder an meinem Gratisprovider, der das nicht zulässt? Vielleicht darf man da keine ganzen Adressen (also mit http://...) eingeben. Gibt es in dem Fall eine Möglichkeit, das Problem zu umgehen?
Title: Re: [Mod] Random image / Zufallsbild
Post by: harle on September 17, 2002, 11:33:53 PM
hier stand nichts.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Gre on September 24, 2002, 05:59:53 PM
Hi,

wie Ihr wisst verwende ich phpnuke.


(Problem geloest. Vgl.

http://www.4homepages.de/forum/viewtopic.php?p=8606#8606

)
Title: Re: [Mod] Random image / Zufallsbild
Post by: xtase on September 25, 2002, 01:54:02 PM
hallo

hat vielleicht jemand von euch ein wbb (woltlab burning board) mit portal ... ??

ich wuerde nemlich gerne sowas in eine portalbox einbinden, das man dann dort eine zufaelliges bildchen sehen kann ... was muss man denn da einbinden ...

und nochwas die gallery liegt auf einem komplett anderen space als das board ist das ein problem ... ??
Title: Re: [Mod] Random image / Zufallsbild
Post by: harle on September 27, 2002, 02:28:01 PM
Hallo,

ich habe auf meiner Startseite 2 Frames. Der obere soll immer bleiben, im unteren ist das Zufallsbild, News etc. Wenn ich jetzt auf das Zufallsbild klicke öffnet sich die Galerie in einem neuen Fenster, aber ich will dass sie sich nur im Mainframe öffnet, sprich der obere Frame bleibt.

Siehe www.spiegelbilder.2in.de

Was muss ich ändern?
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on September 27, 2002, 04:31:13 PM
@harle,

ich würde sagen mit target=\"_main\" oder vielleicht target=\"mainFrame\" im random script ...
Title: Re: [Mod] Random image / Zufallsbild
Post by: xtase on September 27, 2002, 07:16:30 PM
hallo

ich habe da auch so meine probleme bei der einbindung ...

gallery ist auf ... http://mitglied.lycos.de/xtase
board ist auf ... http://xtase.net/forum/auto

da will ich es in einem portal einbinden ...

wie geht das denn da und wo muss ich die random.php hinspielen ??!!
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on September 27, 2002, 07:24:18 PM
@xtase,

sind das zwei verschiedene server ?

wenn ja, irgendwo bei diesen mode hab ich eine javascript einbindung gepostet ....
Title: Re: [Mod] Random image / Zufallsbild
Post by: harle on September 27, 2002, 08:09:41 PM
Quote from: Nicky
@harle,

ich würde sagen mit target=\"_main\" oder vielleicht target=\"mainFrame\" im random script ...


das habe ich auch schon versucht, aber irgendwie ging dann alles kaputt. Könntest du mir sagen, wo genau das hin muss? ich hatte es hinter den Link gesetzt.
Title: Re: [Mod] Random image / Zufallsbild
Post by: xtase on September 27, 2002, 08:37:40 PM
Quote from: Nicky
@xtase,

sind das zwei verschiedene server ?

wenn ja, irgendwo bei diesen mode hab ich eine javascript einbindung gepostet ....


ja es liegt auf 2 server ...

aber wenn das nur so einfach wäre da muss man nemlich irgendwie beim wbb am code herumfummeln irgendwie muss man da die random.php per file() in eine Var schreiben dann str_replace das es mit {name} verfügbar ist und dann in die jeweilige portalbox reinschreiben {name} habe ich mir sagen lassen aber wie das geht *hehe* da bin ich gerade mal dabei zu gucken ob ich das hinbekomme ... die gallery und das wbb vertragen sich halt doch noch nicht so gut ... :D  :D
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on September 27, 2002, 09:44:56 PM
du brauchst im wbb code nicht viel herumfummeln..

es reicht nur in einen oder mehreren templates dies einzufügen:
http://www.4homepages.de/forum/viewtopic.php?p=6794#6794

natürlich mit entsprechender änderung in der random.php auf dem lycos server
Title: Re: [Mod] Random image / Zufallsbild
Post by: xtase on September 27, 2002, 11:49:50 PM
öhm habe ich das jetzt richtig verstanden ... !! ... ich muss die random auf den lycos server packen obwohl ich die gallery extern auf xtase.net in meinem board einbinden will ... ??

ich habe immer geglaubt ich muss dasd random.php auf xtase.net packen und es dann von dort aus auf aufrufen weil man ja den code für die gallery eh angeben muss in der datei selber ...
Title: Re: [Mod] Random image / Zufallsbild
Post by: Michi on October 15, 2002, 11:51:33 PM
Kann das bitte mal jemand in einen Script legen ? :D
Das hier ist ja das grösste Chaos, das ich je gesehen habe !

Also eine Komplettlösung wäre ja das beste für alle, auch für Newbies wie mich !


Gruss

Michi
Title: Re: [Mod] Random image / Zufallsbild
Post by: Michi on October 16, 2002, 12:07:04 AM
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
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on October 16, 2002, 12:07:43 AM
olala,

eine komplettlösung wird es NIE geben, wenn alle es anders einbinden möchten....

also,

was geht bei dir nicht ¿  :roll:
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky 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..
Title: Re: [Mod] Random image / Zufallsbild
Post by: Michi 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
Title: Re: [Mod] Random image / Zufallsbild
Post by: Michi on October 16, 2002, 05:00:37 PM
Cool  :oops:

Es funktioniert nun alles !

Danke
Title: Re: [Mod] Random image / Zufallsbild
Post by: Michi 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
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky 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..
Title: Re: [Mod] Random image / Zufallsbild
Post by: Michi 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
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on October 18, 2002, 03:52:09 PM
das hätten wir schon einige male besprochen...

lese diesen thread von anfang an...
Title: Re: [Mod] Random image / Zufallsbild
Post by: hoelzlmani 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?
Title: Re: [Mod] Random image / Zufallsbild
Post by: Andre 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è
Title: Re: [Mod] Random image / Zufallsbild
Post by: BevS97 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
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on October 29, 2002, 07:36:22 AM
@BevS97,

you can't use php inludes into HTML files ;)
Title: Re: [Mod] Random image / Zufallsbild
Post by: BevS97 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
Title: Re: [Mod] Random image / Zufallsbild
Post by: Matthias70 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
Title: Re: [Mod] Random image / Zufallsbild
Post by: BevS97 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
Title: Re: [Mod] Random image / Zufallsbild
Post by: Matthias70 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
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on November 04, 2002, 02:55:21 PM
naja, musst auch die $sql query ergänzen..
SQL SELECT .....
Title: Re: [Mod] Random image / Zufallsbild
Post by: Matthias70 on November 04, 2002, 05:38:49 PM
Danke für den Tipp, jetzt läufts.
viele Grüße
Matthias

www.gpaed.de
Title: Re: [Mod] Random image / Zufallsbild
Post by: malavolta_m 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?
Title: Re: [Mod] Random image / Zufallsbild
Post by: Bärbel 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!!!
Title: Re: [Mod] Random image / Zufallsbild
Post by: Jan 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
Title: Re: [Mod] Random image / Zufallsbild
Post by: Bärbel 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!!!
Title: Re: [Mod] Random image / Zufallsbild
Post by: Jan 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
Title: Re: [Mod] Random image / Zufallsbild
Post by: Bärbel 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...
Title: Re: [Mod] Random image / Zufallsbild
Post by: Jan 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
Title: Re: [Mod] Random image / Zufallsbild
Post by: Bärbel on November 20, 2002, 01:18:34 PM
Vielen, vielen Dank!!!!!
Es funktioniert!
Title: Re: [Mod] Random image / Zufallsbild
Post by: boxerbay 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!
Title: Re: [Mod] Random image / Zufallsbild
Post by: Jan 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
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no 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.
Title: Re: [Mod] Random image / Zufallsbild
Post by: boxerbay 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";

?>
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no 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 ^^^
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on November 28, 2002, 03:26:34 AM
I've seen modification how to make random.php work with sertan categories, but is that possible use all categories and filter the ones I dont want to use?
if I have 200+ categories this way:
Code: [Select]
AND a.cat_id IN (4, 9, 15)
would be just pain...if I dont want use 2 categories...
or it would be easier if I creat a new group, then set witch categories that group can access and use this code?:
Code: [Select]
AND b.auth_viewimage=2
or that code only works as 'guest','registered', or 'admin'? (sry, dont speak  german)
Title: Re: [Mod] Random image / Zufallsbild
Post by: irocracer on November 30, 2002, 06:13:52 AM
I'm having a problem

i get this x boxes
http://www.torquespeed.net/random.php
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on November 30, 2002, 08:13:41 AM
irocracer, I have the same problem when use
Code: [Select]
AND a.cat_id IN (4, 9, 15) format.
it's only works for me with first, original format
Code: [Select]
       AND a.cat_id = b.cat_id
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on November 30, 2002, 08:25:02 AM
I think I fixed the script when it chose non picture file and shows red X.
I modified it so now it wont return full <img code, but will return full path with filename. Plus now u can show thumbnail and/or full picture.
Code: [Select]
<?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/');  // change this to your 4images dir.
include(ROOT_PATH.'config.php');
include(
ROOT_PATH.'includes/db_mysql.php');
include(
ROOT_PATH.'includes/constants.php');
define('ICON_PATH'ROOT_PATH.TEMPLATE_DIR."/default/icons/"); // path to your template icons.
$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)) ? 0;
}
function 
get_file_extension($file_name) {
 
 ereg("(.+)\.(.+)"basename($file_name), $regs);
 
 return strtolower($regs[2]);
}
function 
check_thumb_type($file_name) {
 
 return (preg_match('#(gif|jpg|jpeg|png)$#is'$file_name)) ? 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_media_file, 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_extention get_file_extension($row['image_media_file']);
$image_id $row['image_id'];
$cat_id $row['cat_id'];
$image_name $row['image_name'];
$image_comments $row['image_comments'];

if (empty(
$row['image_thumb_file'])) { 
 
 $thumb_src ICON_PATH."/".$image_extention.".gif"

else {
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
}
if (!
check_thumb_type($image_extention)) {
$full_src ICON_PATH."/".$image_extention.".gif";
}
else {
$full_src = (is_remote($row['image_media_file'])) ? $row['image_media_file'] : ROOT_PATH.MEDIA_DIR."/".$cat_id."/".$row['image_media_file'];
}
$full_src_link ROOT_PATH."details.php?image_id=$image_id";
?>
Now u'll need call random.php file just ones
Code: [Select]
<?php include("random.php"); ?>
after that u can show thumbnail:
Code: [Select]
<img src="<?php echo $thumb_src?>" border="1">or show full picture:
Code: [Select]
<img src="<?php echo $full_src?>" border="1">if u need add link to the image, use like this:
Code: [Select]
<a href="<?php echo $full_src_link?>">
<img src="<?php echo $thumb_src?>" border="1">
</a>
Title: Re: [Mod] Random image / Zufallsbild
Post by: irocracer on December 01, 2002, 01:27:11 AM
not sure if i set this right : can you double check it ?


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', '/home/virtual/site1/fst/var/www/html/members/gallery/');  // change this to your 4images dir.
include(ROOT_PATH.'config.php');
include(ROOT_PATH.'includes/db_mysql.php');
include(ROOT_PATH.'includes/constants.php');
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/home/virtual/site1/fst/var/www/html/default/icons/"); // path to your template icons.
$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;
}
function get_file_extension($file_name) {
  ereg("(.+)\.(.+)", basename($file_name), $regs);
  return strtolower($regs[2]);
}
function check_thumb_type($file_name) {
  return (preg_match('#(gif|jpg|jpeg|png)$#is', $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_media_file, 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_extention = get_file_extension($row['image_media_file']);
$image_id = $row['image_id'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];

if (empty($row['image_thumb_file'])) {
  $thumb_src = ICON_PATH."/".$image_extention.".gif";
}
else {
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
}
if (!check_thumb_type($image_extention)) {
   $full_src = ICON_PATH."/".$image_extention.".gif";
}
else {
   $full_src = (is_remote($row['image_media_file'])) ? $row['image_media_file'] : ROOT_PATH.MEDIA_DIR."/".$cat_id."/".$row['image_media_file'];
}
$full_src_link = ROOT_PATH."details.php?image_id=$image_id";
?>
Title: Re: [Mod] Random image / Zufallsbild
Post by: irocracer on December 01, 2002, 01:39:48 AM
this is my test page
http://www.torquespeed.net/test/main.php
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on December 01, 2002, 01:42:15 AM
no, one line should be like this:
Code: [Select]
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/default/icons/"); // path to your template icons.

since u already set ROOT_PATH, u dont need repeat it for ICON_PATH
u only need change path for ICON_PATH if u use different templates then default, then just change /default/icons/ to /your_templates_folder/icons/
Title: Re: [Mod] Random image / Zufallsbild
Post by: irocracer on December 01, 2002, 02:28:05 AM
sorry to be buggin you :

i have this error on the test page
Quote

Warning: Failed opening './members/gallery/config.php' for inclusion (include_path='.:/php/includes:/usr/share/php') in /home/virtual/site1/fst/var/www/html/random.php on line 29

Warning: Failed opening './members/gallery/includes/db_mysql.php' for inclusion (include_path='.:/php/includes:/usr/share/php') in /home/virtual/site1/fst/var/www/html/random.php on line 30

Warning: Failed opening './members/gallery/includes/constants.php' for inclusion (include_path='.:/php/includes:/usr/share/php') in /home/virtual/site1/fst/var/www/html/random.php on line 31

Fatal error: Cannot instantiate non-existent class: db in /home/virtual/site1/fst/var/www/html/random.php on line 33


you can find my test page here
http://www.torquespeed.net/test/main.php
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on December 01, 2002, 03:16:12 AM
well, I can see, that u use compleately different gallery script, not 4images:
http://gallery.menalto.com/modules.php?op=modload&name=News&file=index
atleast,
Quote
define('ROOT_PATH', '/home/virtual/site1/fst/var/www/html/members/gallery/'
point to that gallery.
if u use 4images, make sure that this path point to root of 4images directory.
Title: Re: [Mod] Random image / Zufallsbild
Post by: irocracer on December 01, 2002, 05:36:29 AM
Quote from: V@no
well, I can see, that u use compleately different gallery script, not 4images:
http://gallery.menalto.com/modules.php?op=modload&name=News&file=index
atleast,
Quote
define('ROOT_PATH', '/home/virtual/site1/fst/var/www/html/members/gallery/'
point to that gallery.
if u use 4images, make sure that this path point to root of 4images directory.


ya i have too , but the main gallery i use is 4 images
www.torquespeed.net ...... i'm transfering all images from the old to the new which is 4images..

4images ,
www.torquespeed.net/members/gallery
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on December 01, 2002, 06:23:59 AM
ah, ok. now I see where is the problem:
try change this:
Code: [Select]
define('ROOT_PATH', '/home/virtual/site1/fst/var/www/html/members/gallery/'); to this:
Code: [Select]
define('ROOT_PATH', './members/gallery/');
Title: Re: [Mod] Random image / Zufallsbild
Post by: irocracer on December 01, 2002, 06:58:51 AM
this is what the random.php file looks like

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', './members/gallery/');  // change this to your 4images dir.
include(ROOT_PATH.'config.php');
include(ROOT_PATH.'includes/db_mysql.php');
include(ROOT_PATH.'includes/constants.php');
define('ICON_PATH', ROOT_PATH.TEMPLATE_DIR."/templates/default/icons/"); // path to your template icons.
$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;
}
function get_file_extension($file_name) {
  ereg("(.+)\.(.+)", basename($file_name), $regs);
  return strtolower($regs[2]);
}
function check_thumb_type($file_name) {
  return (preg_match('#(gif|jpg|jpeg|png)$#is', $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_media_file, 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_extention = get_file_extension($row['image_media_file']);
$image_id = $row['image_id'];
$cat_id = $row['cat_id'];
$image_name = $row['image_name'];
$image_comments = $row['image_comments'];

if (empty($row['image_thumb_file'])) {
  $thumb_src = ICON_PATH."/".$image_extention.".gif";
}
else {
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
}
if (!check_thumb_type($image_extention)) {
   $full_src = ICON_PATH."/".$image_extention.".gif";
}
else {
   $full_src = (is_remote($row['image_media_file'])) ? $row['image_media_file'] : ROOT_PATH.MEDIA_DIR."/".$cat_id."/".$row['image_media_file'];
}
$full_src_link = ROOT_PATH."details.php?image_id=$image_id";
?>
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on December 01, 2002, 07:30:06 AM
ok, lets see.
since u put your random.php (main.php) file in /text/ dir, u'll need change
Code: [Select]
define('ROOT_PATH', './members/gallery/'); to this
Code: [Select]
define('ROOT_PATH', '../../members/gallery/'); if that wont work, try delete one ' ../ ' so it would looks like this:
../members/gallery/
and about ICON_PATH, u put extra ' /templates/ '
delete it because its allready added by TEMPLATE_DIR
Title: Re: [Mod] Random image / Zufallsbild
Post by: irocracer on December 01, 2002, 10:31:31 AM
lol... error
Quote
 

 
Warning: Failed opening '././members/gallery/config.php' for inclusion (include_path='.:/php/includes:/usr/share/php') in /home/virtual/site1/fst/var/www/html/random.php on line 29

Warning: Failed opening '././members/gallery/includes/db_mysql.php' for inclusion (include_path='.:/php/includes:/usr/share/php') in /home/virtual/site1/fst/var/www/html/random.php on line 30

Warning: Failed opening '././members/gallery/includes/constants.php' for inclusion (include_path='.:/php/includes:/usr/share/php') in /home/virtual/site1/fst/var/www/html/random.php on line 31

Fatal error: Cannot instantiate non-existent class: db in /home/virtual/site1/fst/var/www/html/random.php on line 33


test page 1
http://www.torquespeed.net/test/main.php

test page 2
http://www.torquespeed.net/test.php

random.php
http://www.torquespeed.net/random.php
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on December 01, 2002, 05:35:28 PM
hmmm....did u copy/past my code?
make sure it's ../ not ./
let me explain what is the differenece between those two.
if u have your gallery as www.yoursite.com/members/gallery/
and then u put your random.php into www.yoursite.com/test/random.php
then u must change ROOT_PATH to ../members/gallery/
if u put as ./members/gallery/ the server will trying find your path as www.yoursite.com/test/members/gallery/

" ../ " means, server will look one directory behind it was called from.
" ./ " means, server will look from the same directory it was called from.
so, again. as many dirrectories are bihind your random.php (/test/proba/random/pictures/random.php ) as many ../../../../ u must put to make sure server look from the root.
hope this can help.
so, if u run your random.php from the root, change to this: ./members/gallery/
if u run from /test/random.php - to this: ../members/gallery/
Title: Re: [Mod] Random image / Zufallsbild
Post by: irocracer on December 01, 2002, 07:14:43 PM
OIC ... let me play with it today ..
so , i have to place random.php into folder called " test ' ?
ok , give that a try

I do wait to thak you so much for the help your giving me .... by now, i'll be hitting head on the computer screen about 20 times...  

>>>>>>>>>>>>>>>>>>>  I'll give it a try and i';; let you know
thanks


Quote from: V@no
hmmm....did u copy/past my code?
make sure it's ../ not ./
let me explain what is the differenece between those two.
if u have your gallery as www.yoursite.com/members/gallery/
and then u put your random.php into www.yoursite.com/test/random.php
then u must change ROOT_PATH to ../members/gallery/
if u put as ./members/gallery/ the server will trying find your path as www.yoursite.com/test/members/gallery/

" ../ " means, server will look one directory behind it was called from.
" ./ " means, server will look from the same directory it was called from.
so, again. as many dirrectories are bihind your random.php (/test/proba/random/pictures/random.php ) as many ../../../../ u must put to make sure server look from the root.
hope this can help.
so, if u run your random.php from the root, change to this: ./members/gallery/
if u run from /test/random.php - to this: ../members/gallery/
Title: Re: [Mod] Random image / Zufallsbild
Post by: irocracer on December 02, 2002, 02:44:50 AM
ok , still not working ... i have no idea ...

but this is what i have ..

test page:
http://www.torquespeed.net/test.php     > I get X boxes and links going no where..

location of Random:
http://www.torquespeed.net/random.php

code am using for /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', './members/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";
?>



code in html:    /test.php
Quote
<html>
<?php require("/home/virtual/site1/fst/var/www/html/forums/main.php"); ?>
<body bgcolor="#DFDFDF" link="#66899C" alink="#FF0000" vlink="#66899C">
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber12">
  <tr>
    <td width="100%">
    <p align="center">&nbsp;<?php require("/home/virtual/site1/fst/var/www/html/php/header.php"); ?></td>
  </tr>
  </table>
<div align="center">
  <center>
  <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="93%" id="AutoNumber7" height="15">
    <tr>
      <td width="100%" height="1" background="http://www.torquespeed.net/forums/style_images/1/tile_back.gif">
      &nbsp;<?php
echo bar(1);
?></td>
    </tr>
    </table>
    </center>
  </div>
<p style="margin-top: 0; margin-bottom: 0" align="center">&nbsp;          
<div align="center">
  <center>
  <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="93%" id="AutoNumber1" height="30">
    <tr>
      <td width="100%" height="30">
      <div align="center">
        <center>
        <table border="0" cellpadding="0" cellspacing="0" width="100%" id="AutoNumber19">
          <tr>
            <td width="100%">
            <p align="center">&nbsp;<?php require("./random.php"); ?><img src="<?php echo $thumb_src; ?>" border="1"></td>
          </tr>
          <tr>
            <td width="100%">&nbsp;</td>
          </tr>
        </table>
        </center>
      </div>
      <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber10" height="25">
        <tr>
          <td width="100%" height="25" background="http://www.torquespeed.net/forums/style_images/1/tile_back.gif">&nbsp;<img border="0" src="http://www.torquespeed.net/forums/style_images/1/nav_m.gif" width="8" height="8">
      <font color="#FFFFFF" face="Tahoma">Home</font></td>
        </tr>
      </table>
      </td>
    </tr>
    <tr>
      <td width="100%" height="14" style="border-left-style: solid; border-left-width: 1; border-right-style: solid; border-right-width: 1">
      <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#FFFFFF" width="100%" id="AutoNumber14">
        <tr>
          <td width="50%" bordercolor="#FFFFFF">
          <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber15">
            <tr>
              <td width="100%">&nbsp;<?php
echo news(7,2,0,500);
?></td>
            </tr>
          </table>
          </td>
          <td width="50%" bordercolor="#FFFFFF">
          <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber16">
            <tr>
              <td width="100%">
              <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber17">
                <tr>
                  <td width="100%" background="http://www.torquespeed.net/forums/style_images/1/tile_sub.gif">
                  <p align="center">Top 12 Topics</td>
                </tr>
                </table>
              </td>
            </tr>
            <tr>
              <td width="100%">
              <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber18">
                <tr>
                  <td width="2%" bgcolor="#FFFFFF">&nbsp;</td>
                  <td width="98%" bgcolor="#FFFFFF">&nbsp;<?php
echo posts_x(12);
?></td>
                </tr>
                <tr>
                  <td width="2%" bgcolor="#FFFFFF">&nbsp;</td>
                  <td width="98%" bgcolor="#FFFFFF">&nbsp;</td>
                </tr>
              </table>
              </td>
            </tr>
          </table>
          </td>
        </tr>
      </table>
        </td>
      </tr>
      <tr>
        <td width="100%" height="14" bgcolor="#9FB3D0">
        <table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber11">
          <tr>
            <td width="50%">&nbsp;</td>
            <td width="50%">
            <p align="right">&nbsp;</td>
          </tr>
        </table>
        </td>
      </tr>
    </table>
    </center>
  </div>
  <p style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber13">
  <tr>
    <td width="100%">
    <p align="center"><?php require("/home/virtual/site1/fst/var/www/html/php/footer.php"); ?></td>
  </tr>
  <tr>
    <td width="100%">&nbsp;</td>
  </tr>
</table>
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on December 03, 2002, 12:04:07 AM
dokterjur:
Quote
Hi, I want to include a random image into my site, but im getting this error:

Parse error: parse error in /usr/local/slash/apache/vhosts/beachhousepaal1.com/httpdocs/fotoalbum/4images/random.php on line 34

Here is my code

<?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
define('ROOT_PATH', 'http://www.beachhousepaal1.com/fotoalbum/4images/');

include(ROOT_PATH.'config.php');
include(ROOT_PATH.'includes/db_mysql.php');
include(ROOT_PATH.'includes/constants.php');

$site_db = new Db($db_http://www.beachhousepaal1.com, $db_***, $db_***, $db_fotoalbum); //Wow! what happend to this line?
function is_remote($file_name) {
return (preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $file_name)) ? 1 : 0;
}

I suggest u delite this file and start over.
its looks like u edited it too much. from the entire script all u need is change ROOT_PATH nothing else.
so, in your case, since u r trying to run random.php from the same directory as your 4images script u'll need change ROOT_PATH like this:
Code: [Select]
define('ROOT_PATH', './');
that should be it.
if u want put random.php file into different directory, then u'll need change  ./  for ROOT_PATH as I 'tryed' explain in my previos replyes.
Title: Re: [Mod] Random image / Zufallsbild
Post by: dokterjur on December 03, 2002, 11:25:56 AM
Thanks! It worked! You can check it out at http://www.beachhousepaal1.com/test
This site is in Dutch language and only the first page works at this moment.
Title: Re: [Mod] Random image / Zufallsbild
Post by: irocracer on December 03, 2002, 10:09:07 PM
man , i really need this mod , but for somereason is not working for me... this can be my problem....  

I have 4images working for my board: this is the hack i installed:
http://www.ibresource.com/forums/index.php?act=ST&f=6&t=3830&s=83d869d97b7eb66136bd0bb21298c28e

my gallery:
http://www.torquespeed.net/members/gallery/

My Random code looks like this:
http://www.torquespeed.net/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', './members/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";
?>


I get notthing but x boxes and links going no where
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on December 03, 2002, 11:52:51 PM
Well, I really dont know now, we tryed with u all kind of stuff...
but I asume, that integration 4mages with IBF does correction in 4images Database. and random.php cant correctly read information from database.
I'll try to look what changes make IBF integration, but, since I know almost nothing about PHP and MySQL...
maybe somebody else can figure it out?
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on December 04, 2002, 12:05:27 AM
Hey, I got an idea!
when u integrated 4images with IBF u had to replace constants.php file.
so, try to put in /includes/ folder original 4images constants.php file, but rename it as constants2.php and change in random.php
include(ROOT_PATH.'includes/constants2.php');
probably wont work, but worth to try. ;)
Title: Re: [Mod] Random image / Zufallsbild
Post by: irocracer on December 04, 2002, 08:33:36 PM
nope , same problem ... x boxes .... humm there has to be a way
Title: Re: [Mod] Random image / Zufallsbild
Post by: Jan on December 04, 2002, 09:03:47 PM
Take a look at the HTML source code of your page and check the image source.

Jan
Title: Re: [Mod] Random image / Zufallsbild
Post by: BerKay on December 05, 2002, 05:09:35 PM
i get following erorrs when i try to run on my computer using PHPTriad:

Warning: Failed opening 'http://localhost/test/4images/config.php' for inclusion (include_path='.;c:\php4\pear') in C:\PROGRAM FILES\PHP EXPERT EDITOR\php60B3.TMP on line 32

Warning: Failed opening 'http://localhost/test/4images/includes/db_mysql.php' for inclusion (include_path='.;c:\php4\pear') in C:\PROGRAM FILES\PHP EXPERT EDITOR\php60B3.TMP on line 33

Warning: Failed opening 'http://localhost/test/4images/includes/constants.php' for inclusion (include_path='.;c:\php4\pear') in C:\PROGRAM FILES\PHP EXPERT EDITOR\php60B3.TMP on line 34

Fatal error: Cannot instantiate non-existent class: db in C:\PROGRAM FILES\PHP EXPERT EDITOR\php60B3.TMP on line 36
Title: Re: [Mod] Random image / Zufallsbild
Post by: BerKay on December 05, 2002, 05:12:54 PM
here is the lines that i have edited :

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH', 'http://localhost/test/4images/');

include(ROOT_PATH.'config.php');
include(ROOT_PATH.'includes/db_mysql.php');
include(ROOT_PATH.'includes/constants.php');
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on December 05, 2002, 07:35:02 PM
http://4homepages.de/forum/viewtopic.php?p=12199#12199
Title: Re: [Mod] Random image / Zufallsbild
Post by: irocracer on December 06, 2002, 08:58:00 AM
Quote from: Jan
Take a look at the HTML source code of your page and check the image source.

Jan


html code , what you mean .. please detail me
Title: Re: [Mod] Random image / Zufallsbild
Post by: Grummel on December 08, 2002, 03:49:18 PM
Hi Leuts,
hat jemand eine Idee wie ich folgenden Fehler beseitigen könnte?
Quote
Fatal error: Cannot redeclare class db in /kunden/mysterynews.net/webseiten/gallery/includes/db_mysql.php on line 28


Edit: Habs gefunden. Hatte irrtümlicher weise die random.php doppelt included. :)
Title: Re: [Mod] Random image / Zufallsbild
Post by: irocracer on December 10, 2002, 08:24:41 AM
is there another way where i can get the ramdom images for people that use the IBF mod ?
Title: Re: [Mod] Random image / Zufallsbild
Post by: jscharf on December 28, 2002, 01:50:51 PM
Hallo,

habe mit einiger Mühe das Zufallbild in eine Portalbox eingebunden. (Habe dazu das Script benutzt)
Wie kriege ich denn Jetzt die Bildbeschreibung dazu?

Jörg

Okay, war easy, sollte zuerst Kopf einschalten!
Funktioniert einwandfrei!
Title: Re: [Mod] Random image / Zufallsbild
Post by: sorestar on January 08, 2003, 04:35:03 AM
i received this error after i put it in random_more_pics.php on my index.php page


Quote
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 4images_images a, phpbb_categories b WHERE a.image_active=1 AND a.cat_id = b.cat_id AND b.auth_viewcat=0 AND b.auth_viewimage=0 ORDER BY RAND() LIMIT 4
Unknown column 'b.auth_viewcat' in 'where clause'


help please?

thanks :(
Title: Re: [Mod] Random image / Zufallsbild
Post by: sorestar on January 08, 2003, 04:36:37 AM
Quote
and this is the code

<?php
// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH', './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;
}

// 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 RAND()
        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=\"0\" alt=\"$image_name\"></a><br>\n";
  echo "<b>$image_name</b><br>\n";
  echo "Comments: $image_comments<hr>\n";
}
?>
Title: Re: [Mod] Random image / Zufallsbild
Post by: Jan on January 08, 2003, 09:29:48 AM
You have a wrong table name in your query: phpbb_categories

If you don't find the error, just change
Code: [Select]
".CATEGORIES_TABLE."
to
Code: [Select]
4images_categoriesJan
Title: Re: [Mod] Random image / Zufallsbild
Post by: sorestar on January 08, 2003, 10:05:39 PM
I did just like wat u said Jan....I change

Quote
".CATEGORIES_TABLE."


to
Quote
4images_categories


but i got this error:

Parse error: parse error in /home2/klh/public_html/randommulti.php on line 43


 :?:
Title: Re: [Mod] Random image / Zufallsbild
Post by: Jan on January 08, 2003, 11:24:36 PM
Can you post line 43.

Jan
Title: Re: [Mod] Random image / Zufallsbild
Post by: sorestar on January 08, 2003, 11:39:16 PM
ok this is the line

Quote
     LINE 43 ----->  FROM ".IMAGES_TABLE." a, "4images_categories" b  
[/code]
Title: Re: [Mod] Random image / Zufallsbild
Post by: Jan on January 09, 2003, 10:02:40 AM
You did not read my instructions correctly ;)
Code: [Select]
FROM ".IMAGES_TABLE." a, 4images_categories b
Don't put the double quotes around 4images_categories.

Jan
Title: Re: [Mod] Random image / Zufallsbild
Post by: SLL on January 09, 2003, 01:27:01 PM
This mod works fine for me, as well as phpBB Fetch Info does, but only one of these mods on the same page, alone. When I'm trying to run both mods together, on the same page, the phpBB Fetch Info doesn't work at all. I'm using different database for 4images and pbpBB.

Please advise, what could be the reason for this conflict? Thanks in advance!

Code: [Select]
<?php
#################################################################
## Mod Title&#58;   phpBB Fetch Info
## Author&#58;      Ca5ey <ca5ey@clanunity.net> Volker Rattel
#################################################################
#-----[ EXAMPLE USAGE &#93;------------------------------------------
## <?php
## define&#40;'IN_PHPBB', true&#41;;
## include&#40;'phpbb_fetch_info.php'&#41;;
## $info = phpbb_fetch_info&#40;&#41;;
## 
?>

## Total Posts: <?php echo $info['f_total_posts'&#93;; ?><br>
## Total Users: <?php echo $info['f_total_users'&#93;; ?><br>
## Newest User: <?php echo $info['newest_username'&#93;; ?><br>
## Newest User ID: <?php echo $info['newest_userid'&#93;; ?><br>
## User Online: <?php echo $info['f_user_online'&#93;; ?><br>
#################################################################
$phpbb_root_path = './phpBB2/';
$CFG['close_db'] = 1;

if (!file_exists($phpbb_root_path . 'extension.inc')) {
    die('<b>phpBB Fetch Info:</b> The $phpbb_root_path setting is wrong and DOES NOT point to your forum.');
}
include_once ($phpbb_root_path . 'extension.inc');
include_once ($phpbb_root_path . 'common.'.$phpEx);

function phpbb_fetch_info()
{

    global $db;
    $info = array();
    $info['f_total_posts']     = get_db_stat('postcount');
    $info['f_total_users']     = get_db_stat('usercount');
    $newest_user             = get_db_stat('newestuser');
    $info['newest_userid']   = $newest_user[0];
    $info['newest_username'] = $newest_user[1];

    $sql = 'SELECT
              COUNT(session_id)
            FROM
              ' . SESSIONS_TABLE . '
            WHERE
              session_time >= ' . ( time() - 300 );

    if( !($result = $db->sql_query($sql)) ) {
        message_die(GENERAL_ERROR, 'Could not obtain user/online information', '', __LINE__, __FILE__, $sql);
    }

    $f_user_online = $db->sql_fetchrow($result);
    $info['f_user_online'] = $f_user_online[0];

    if ($CFG['close_db']) {
        $db->sql_close();
    }
    return $info;

} // phpbb_fetch_info

?>

Title: Re: [Mod] Random image / Zufallsbild
Post by: sorestar on January 11, 2003, 07:57:22 AM
Thanks Jan

It is woking now.  :)

but there is a conflict with my other fetch post.

like SLL said, i get one to work but then the others don't work.

Thanks again Jan
U R DA MAN!  8)
Title: Re: [Mod] Random image / Zufallsbild
Post by: SLL on January 13, 2003, 12:51:53 PM
YESSS!!!!  I finally got it!   :D

CATEGORIES_TABLE definiton is duplicated in both scripts. Just rename it to anything else and define directly in Random Images script...

That's it!
Title: Re: [Mod] Random image / Zufallsbild
Post by: wrestlingwiredotnet on January 15, 2003, 01:52:37 AM
Hi, I am a little confused with the original directions, I was wondering if someone could write them a little more descriptive, I dont know where to put what and what to put, if you could do this that would be awesome, thanks!

~Nate~
Title: Re: [Mod] Random image / Zufallsbild
Post by: SLL on January 15, 2003, 01:39:46 PM
Quote from: wrestlingwiredotnet
I was wondering if someone could write them a little more descriptive


Sure... just rename one of duplicated definitions to anything else and define them directly in the script (not in the includes!):

Code: [Select]
define('PIC_CATEGORIES_TABLE', '4images_categories');
define('PIC_IMAGES_TABLE', '4images_images');


{skipped}

Code: [Select]
$sql = "SELECT COUNT(*) as total_images FROM ".PIC_IMAGES_TABLE." a, ".PIC_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 = $pics_db->query_firstrow($sql);


More clear now?  :wink:
Title: Re: [Mod] Random image / Zufallsbild
Post by: wrestlingwiredotnet on January 15, 2003, 04:58:06 PM
no. sorry SLL, im still confused, but once I started uploading images the random image appeared on every page and its working so... thanks anyway though!



~Nate~
Title: Re: [Mod] Random image / Zufallsbild
Post by: SLL on January 15, 2003, 08:30:24 PM
Quote from: wrestlingwiredotnet
no. sorry SLL, im still confused


Now I know why  :)   You are talking about random images in 4images, but this MOD shows random image outside your gallery, just on any webpage, for example, on the title page of your website. Have a look, how it works at http://www.dalnet.ru
Title: Re: [Mod] Random image / Zufallsbild
Post by: sorestar on January 16, 2003, 04:35:40 AM
Quote
define('PIC_CATEGORIES_TABLE', '4images_categories');
define('PIC_IMAGES_TABLE', '4images_images');



which file is it under?

can you post the completed script here, please?
 :)
[/quote]
Title: Re: [Mod] Random image / Zufallsbild
Post by: SLL on January 16, 2003, 11:54:56 AM
Quote from: sorestar
can you post the completed script here, please?


OK, to make our life easier, below are three scripts running on the homepage of my site:

The code is not mine! I just modified it a bit and have managed scripts to work on the same page.

Save this one as random.php
Code: [Select]
<?php
define
&#40;'ROOT_PATH', './4images/'&#41;;
define&#40;'SITE_URL', 'http&#58;//faces.dalnet.ru/'&#41;;

include_once&#40;ROOT_PATH.'config.php'&#41;;
include_once&#40;ROOT_PATH.'includes/db_mysql.php'&#41;;

define&#40;'PIC_CATEGORIES_TABLE', '4images_categories'&#41;;
define&#40;'PIC_IMAGES_TABLE', '4images_images'&#41;;
define&#40;'THUMB_DIR', 'data/thumbnails'&#41;;
define&#40;'AUTH_ALL', 0&#41;;
define&#40;'AUTH_USER', 2&#41;;
define&#40;'AUTH_ACL', 3&#41;;
define&#40;'AUTH_ADMIN', 9&#41;;

$pics_db = new Db&#40;$db_host, $db_user, $db_password, $db_name&#41;;

function is_remote&#40;$file_name&#41; &#123;
  
return &#40;preg_match&#40;'#^https?\\&#58;\\/\\/[a-z0-9\-&#93;+\.&#40;[a-z0-9\-&#93;+\.&#41;?[a-z&#93;+#i', $file_name&#41;&#41; ? 1 &#58; 0;
&#125;

$sql "SELECT COUNT&#40;*&#41; as total_images FROM ".PIC_IMAGES_TABLE." a, ".PIC_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 $pics_db->query_firstrow&#40;$sql&#41;;
$total_images $row['total_images'&#93;;

mt_srand&#40;&#40;double&#41;microtime&#40;&#41; * 1000000&#41;;
$number = &#40;$total_images > 1&#41; ? mt_rand&#40;0, $total_images - 1&#41; &#58; 0;

$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments FROM ".PIC_IMAGES_TABLE." a, ".PIC_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 $pics_db->query_firstrow&#40;$sql&#41;;
$image_id $row['image_id'&#93;;
$cat_id $row['cat_id'&#93;;
$image_name $row['image_name'&#93;;
$image_comments $row['image_comments'&#93;;
$thumb_src = &#40;is_remote&#40;$row['image_thumb_file'&#93;&#41;&#41; ? $row['image_thumb_file'&#93; &#58; ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'&#93;;

echo "<a href=\"".SITE_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" vspace=\"2\" alt=\"$image_name\"></a><br>\n";
echo 
"<b><div class=\"ltgreytext\">$image_name</b></div>\n";
echo 
"&raquo; <a target=\"a\" href=\"".SITE_URL."\">âñåãî â àëüáîìå <b>$total_images</b> ôîòî</a><br>\n";
?>


Save this one as recent.php
Code: [Select]
<?php
define
&#40;'IN_PHPBB', true&#41;;

$limit "7"// how many topics to fetch?

$phpbb_root_path "./phpBB2/";
$phpbb_main_url "http&#58;//forum.dalnet.ru/";
include_once&
#40;$phpbb_root_path . 'extension.inc'&#41;;
include_once&#40;$phpbb_root_path . 'common.'.$phpEx&#41;;

$recent_sql "SELECT topic_id,topic_title,topic_last_post_id,forum_id FROM " TOPICS_TABLE " WHERE forum_id !='3' AND forum_id <'8' ORDER BY topic_last_post_id DESC LIMIT $limit";
$recent $db->sql_query&#40;$recent_sql&#41;;

echo "<table cellspacing=0 cellpadding=1 width=\"100%\">";

while &
#40;$line = mysql_fetch_array&#40;$recent&#41;&#41; &#123;
$security=FALSE;
if&
#40;$forum_auth == 2 && $userdata['user_level'&#93; == ADMIN&#41; &#123;
$security=TRUE;
&
#125;
if&#40;$forum_auth == 3 && &#40;$userdata['user_level'&#93; == ADMIN&#41; || &#40;$userdata['user_level'&#93; == 2&#41;&#41; &#123;
$security=TRUE;
&
#125;
if&#40;$forum_auth == 0&#41; &#123;
$security=TRUE;
&
#125;
if&#40;$security == TRUE&#41;
&#123;
  
$lastpost_array=$db->sql_query&#40;"SELECT post_time FROM " . POSTS_TABLE . " WHERE post_id =" . $line['topic_last_post_id'&#93;&#41;;
  
$lastpost=mysql_fetch_array&#40;$lastpost_array&#41;;
  
$lastpost=$lastpost['post_time'&#93;;
  
$lastpost=create_date&#40;"d M - H&#58;m", $lastpost, $board_config['board_timezone'&#93;&#41;;

  
$j stripslashes&#40;$line['topic_title'&#93;&#41;;
  
$k substr&#40;$j, 0, 35&#41; . "...";

  
echo "<tr><td class=\"menutext\" align=\"left\">&raquo; <a target=\"f\" href=\"$phpbb_main_url"viewtopic.php?t=" $line['topic_id'&#93; . "\" class=\"menutext\">" . $k . "</a></td>";
  
echo "<td class=\"ltgreytext\" align=\"right\">$lastpost</td></tr>";

&
#125;&#125;;
echo "</table>";
?>


Save this one as phpbb_fetch_info.php
Code: [Select]
<?php
$phpbb_root_path 
'./phpBB2/';
define &#40;'IN_PHPBB', true&#41;;

include&#40;$phpbb_root_path . 'extension.inc'&#41;;
include_once&#40;$phpbb_root_path.'config.'.$phpEx&#41;;
include_once&#40;$phpbb_root_path.'includes/db.'.$phpEx&#41;;
include_once&#40;$phpbb_root_path.'includes/constants.'.$phpEx&#41;;

function phpbb_fetch_stats&#40;&#41;
&#123;
    
global $db;

    
$result = array&#40;&#41;;
    
$result['total_posts'&#93; = get_db_stat&#40;'postcount'&#41;;
    
$result['total_users'&#93; = get_db_stat&#40;'usercount'&#41;;
    
$newest_user           get_db_stat&#40;'newestuser'&#41;;
    
$result['user_id'&#93;     = $newest_user['user_id'&#93;;
    
$result['username'&#93;    = $newest_user['username'&#93;;

    
$sql 'SELECT session_id FROM ' SESSIONS_TABLE ' WHERE session_time >= ' . &#40;time&#40;&#41; - 300&#41;;
$query $db->sql_query&#40;$sql&#41;;
$user_online $db->sql_fetchrow&#40;$query&#41;;

$result['user_online'&#93; = count&#40;$user_online&#41;;
echo "$table_prefix\n<br>";

    return 
$result;
&
#125;
?>


Then open your index.php and insert the following tags into the proper places:
Code: [Select]
<?php
include&#40;'phpbb_fetch_info.php'&#41;;
$stats phpbb_fetch_stats&#40;&#41;;
echo 'Total posts&#58; ' $stats['total_posts'&#93; . ', total users&#58; ' . $stats['total_users'&#93; . ', now online&#58; ' . $stats['user_online'&#93; . ', last registered&#58; ' . $stats['username'&#93;;
?>


<?php include&#40;"recent.php"&#41;; ?>
<?php include&#40;"random.php"&#41;; ?>


Demo: http://www.dalnet.ru/home.php
Title: Re: [Mod] Random image / Zufallsbild
Post by: sorestar on January 18, 2003, 12:11:27 AM
wow  8)  is is working fantastic!!!!

ABOUT RANDOM.PHP....Can you show me how to set, so that it only randomize certain categories?


Thanks SLL
Title: Re: [Mod] Random image / Zufallsbild
Post by: SLL on January 18, 2003, 11:00:48 AM
Quote from: sorestar
Can you show me how to set, so that it only randomize certain categories?

Try to play with this query:
Code: [Select]
$sql = "SELECT COUNT(*) as total_images FROM ".PIC_IMAGES_TABLE." a, ".PIC_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."";

... adding something like AND b.cat_id !='2' AND b.cat_id <'4'
Title: Re: [Mod] Random image / Zufallsbild
Post by: sorestar on January 18, 2003, 08:59:23 PM
Thanks SSL

 8) U R DA MAN 8)
Title: Re: [Mod] Random image / Zufallsbild
Post by: tradertt on January 23, 2003, 06:29:19 PM
How can I post multiple THUMBNAILS in 1 page?

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

I tried doing it in 2 tables .. but


Fatal error: Cannot redeclare class db in /home/ahahchen/public_html/tradertt/4images/includes/db_mysql.php on line 28


What can I do then?
Title: Re: [Mod] Random image / Zufallsbild
Post by: tradertt on January 23, 2003, 06:37:47 PM
I want to put 2 different random thumbnails in 1 webpage ... but I keep getting that error cause they are querying the same database.. how can I overcome it?
Title: Re: [Mod] Random image / Zufallsbild
Post by: tradertt on January 23, 2003, 06:49:08 PM
Even if I use 1 table ... I keep getting just a CROSS and not a picture and the link to it is


http://www.tipscheck.com/tradertt/4images/details.php?image_id=


WHy is there no image_id    number behind ?
Title: Re: [Mod] Random image / Zufallsbild
Post by: tradertt on January 23, 2003, 06:59:12 PM
Quote from: tradertt
Even if I use 1 table ... I keep getting just a CROSS and not a picture and the link to it is


http://www.tipscheck.com/tradertt/4images/details.php?image_id=


WHy is there no image_id    number behind ?



THis happens when I keep refreshing the page ... I am using a FULL IMAGE random_full.php and if I chg my

AND a.cat_id = 3

the problem occurs

But when I chg it back to

AND a.cat_id = b.cat_id

it does not have this problem .. HELP !!
Title: Re: [Mod] Random image / Zufallsbild
Post by: irocracer on January 24, 2003, 05:52:48 AM
any luck yet on having it work when you have IBF mod in 4images ?
Title: Re: [Mod] Random image / Zufallsbild
Post by: STCD on February 01, 2003, 11:26:18 PM
Quote from: SLL
Quote from: sorestar
can you post the completed script here, please?


OK, to make our life easier, below are three scripts running on the homepage of my site:

    - one to show random image from 4images gallery;
    - one to fetch last few topics from phpBB board;
    - one to fetch some stats from phpBB board;
    [/list:u]
The code is not mine! I just modified it a bit and have managed scripts to work on the same page.

Save this one as random.php
Code: [Select]
<?php
define
&#40;'ROOT_PATH', './4images/'&#41;;
define&#40;'SITE_URL', 'http&#58;//faces.dalnet.ru/'&#41;;

include_once&#40;ROOT_PATH.'config.php'&#41;;
include_once&#40;ROOT_PATH.'includes/db_mysql.php'&#41;;

define&#40;'PIC_CATEGORIES_TABLE', '4images_categories'&#41;;
define&#40;'PIC_IMAGES_TABLE', '4images_images'&#41;;
define&#40;'THUMB_DIR', 'data/thumbnails'&#41;;
define&#40;'AUTH_ALL', 0&#41;;
define&#40;'AUTH_USER', 2&#41;;
define&#40;'AUTH_ACL', 3&#41;;
define&#40;'AUTH_ADMIN', 9&#41;;

$pics_db = new Db&#40;$db_host, $db_user, $db_password, $db_name&#41;;

function is_remote&#40;$file_name&#41; &#123;
  
return &#40;preg_match&#40;'#^https?\\&#58;\\/\\/[a-z0-9\-&#93;+\.&#40;[a-z0-9\-&#93;+\.&#41;?[a-z&#93;+#i', $file_name&#41;&#41; ? 1 &#58; 0;
&#125;

$sql "SELECT COUNT&#40;*&#41; as total_images FROM ".PIC_IMAGES_TABLE." a, ".PIC_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 $pics_db->query_firstrow&#40;$sql&#41;;
$total_images $row['total_images'&#93;;

mt_srand&#40;&#40;double&#41;microtime&#40;&#41; * 1000000&#41;;
$number = &#40;$total_images > 1&#41; ? mt_rand&#40;0, $total_images - 1&#41; &#58; 0;

$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments FROM ".PIC_IMAGES_TABLE." a, ".PIC_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 $pics_db->query_firstrow&#40;$sql&#41;;
$image_id $row['image_id'&#93;;
$cat_id $row['cat_id'&#93;;
$image_name $row['image_name'&#93;;
$image_comments $row['image_comments'&#93;;
$thumb_src = &#40;is_remote&#40;$row['image_thumb_file'&#93;&#41;&#41; ? $row['image_thumb_file'&#93; &#58; ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'&#93;;

echo "<a href=\"".SITE_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" vspace=\"2\" alt=\"$image_name\"></a><br>\n";
echo 
"<b><div class=\"ltgreytext\">$image_name</b></div>\n";
echo 
"&raquo; <a target=\"a\" href=\"".SITE_URL."\">âñåãî â àëüáîìå <b>$total_images</b> ôîòî</a><br>\n";
?>


Save this one as recent.php
Code: [Select]
<?php
define
&#40;'IN_PHPBB', true&#41;;

$limit "7"// how many topics to fetch?

$phpbb_root_path "./phpBB2/";
$phpbb_main_url "http&#58;//forum.dalnet.ru/";
include_once&
#40;$phpbb_root_path . 'extension.inc'&#41;;
include_once&#40;$phpbb_root_path . 'common.'.$phpEx&#41;;

$recent_sql "SELECT topic_id,topic_title,topic_last_post_id,forum_id FROM " TOPICS_TABLE " WHERE forum_id !='3' AND forum_id <'8' ORDER BY topic_last_post_id DESC LIMIT $limit";
$recent $db->sql_query&#40;$recent_sql&#41;;

echo "<table cellspacing=0 cellpadding=1 width=\"100%\">";

while &
#40;$line = mysql_fetch_array&#40;$recent&#41;&#41; &#123;
$security=FALSE;
if&
#40;$forum_auth == 2 && $userdata['user_level'&#93; == ADMIN&#41; &#123;
$security=TRUE;
&
#125;
if&#40;$forum_auth == 3 && &#40;$userdata['user_level'&#93; == ADMIN&#41; || &#40;$userdata['user_level'&#93; == 2&#41;&#41; &#123;
$security=TRUE;
&
#125;
if&#40;$forum_auth == 0&#41; &#123;
$security=TRUE;
&
#125;
if&#40;$security == TRUE&#41;
&#123;
  
$lastpost_array=$db->sql_query&#40;"SELECT post_time FROM " . POSTS_TABLE . " WHERE post_id =" . $line['topic_last_post_id'&#93;&#41;;
  
$lastpost=mysql_fetch_array&#40;$lastpost_array&#41;;
  
$lastpost=$lastpost['post_time'&#93;;
  
$lastpost=create_date&#40;"d M - H&#58;m", $lastpost, $board_config['board_timezone'&#93;&#41;;

  
$j stripslashes&#40;$line['topic_title'&#93;&#41;;
  
$k substr&#40;$j, 0, 35&#41; . "...";

  
echo "<tr><td class=\"menutext\" align=\"left\">&raquo; <a target=\"f\" href=\"$phpbb_main_url"viewtopic.php?t=" $line['topic_id'&#93; . "\" class=\"menutext\">" . $k . "</a></td>";
  
echo "<td class=\"ltgreytext\" align=\"right\">$lastpost</td></tr>";

&
#125;&#125;;
echo "</table>";
?>


Save this one as phpbb_fetch_info.php
Code: [Select]
<?php
$phpbb_root_path 
'./phpBB2/';
define &#40;'IN_PHPBB', true&#41;;

include&#40;$phpbb_root_path . 'extension.inc'&#41;;
include_once&#40;$phpbb_root_path.'config.'.$phpEx&#41;;
include_once&#40;$phpbb_root_path.'includes/db.'.$phpEx&#41;;
include_once&#40;$phpbb_root_path.'includes/constants.'.$phpEx&#41;;

function phpbb_fetch_stats&#40;&#41;
&#123;
    
global $db;

    
$result = array&#40;&#41;;
    
$result['total_posts'&#93; = get_db_stat&#40;'postcount'&#41;;
    
$result['total_users'&#93; = get_db_stat&#40;'usercount'&#41;;
    
$newest_user           get_db_stat&#40;'newestuser'&#41;;
    
$result['user_id'&#93;     = $newest_user['user_id'&#93;;
    
$result['username'&#93;    = $newest_user['username'&#93;;

    
$sql 'SELECT session_id FROM ' SESSIONS_TABLE ' WHERE session_time >= ' . &#40;time&#40;&#41; - 300&#41;;
$query $db->sql_query&#40;$sql&#41;;
$user_online $db->sql_fetchrow&#40;$query&#41;;

$result['user_online'&#93; = count&#40;$user_online&#41;;
echo "$table_prefix\n<br>";

    return 
$result;
&
#125;
?>


Then open your index.php and insert the following tags into the proper places:
Code: [Select]
<?php
include&#40;'phpbb_fetch_info.php'&#41;;
$stats phpbb_fetch_stats&#40;&#41;;
echo 'Total posts&#58; ' $stats['total_posts'&#93; . ', total users&#58; ' . $stats['total_users'&#93; . ', now online&#58; ' . $stats['user_online'&#93; . ', last registered&#58; ' . $stats['username'&#93;;
?>


<?php include&#40;"recent.php"&#41;; ?>
<?php include&#40;"random.php"&#41;; ?>


Demo: http://www.dalnet.ru/home.php


i am getting this error:
Fatal error: Cannot instantiate non-existent class: db in random.php on line 16
(i am only using the random image script)
HELP ME PLEEEASE! :cry:
Title: Re: [Mod] Random image / Zufallsbild
Post by: camo93 on February 06, 2003, 12:13:38 PM
Hi,

Good mod, he work 2 days and now it don't work :-(
he don't to find the image_id=

This is the javascript version : http://central-galerie.com/4images/random.php

a problem with my database ?

Quote from: Nicky
hi an alle, hi all,

D: hier ist der Zufallsbild MOD für extra seiten ausserhalb ihrer Gallerie:
E: here the Random image MOD for extra sites outside your Gallery:

http://www.nicky.net/4images/random.txt

D: speichere den inhalt als random.php
E: save the content as random.php

D: random.php wurde mit folgenden befehl in die random_mod.php inkludiert
E: random.php was included into the random_mod.php site

D: mit
E: with
Code: [Select]

<?php
 
include&#40;"./random.php"&#41;;
?>



D: viel spass
E: have fun

p.s.:
D: vielen dank an JAN der 99% der arbeit geleistet hat ;)
E: many thanks to JAN who maked 99% of this mod ;)
Title: Re: [Mod] Random image / Zufallsbild
Post by: rweoli on February 10, 2003, 01:39:04 PM
Hallo,

ich bekomme beim Versuch das so einzubinden eine Fehlermeldung:

Quote
Warning: Failed opening './4images/config.php' for inclusion (include_path='.:/usr/share/php') in /var/home/rot-weiss-erfurt.com/www/pix/random.php on line 30

Warning: Failed opening './4images/includes/db_mysql.php' for inclusion (include_path='.:/usr/share/php') in /var/home/rot-weiss-erfurt.com/www/pix/random.php on line 31

Warning: Failed opening './4images/includes/constants.php' for inclusion (include_path='.:/usr/share/php') in /var/home/rot-weiss-erfurt.com/www/pix/random.php on line 32

Fatal error: Cannot instantiate non-existent class: db in /var/home/rot-weiss-erfurt.com/www/pix/random.php on line 34


Ich hoffe ich habe alles richitg verstanden, hier deshalb meine Vorgehensweise:

1. random.txt von oben als random.php in 4images Verzeichniss
2. Den Code von oben

Code: [Select]
<?php 
include&#40;"./random.php"&#41;; 
?>


in meine Seite eingefügt. Als das nicht funktionierte, habe ich die Pfadangabe von ./random.php zu http://www.meinedomain.com/ornder/random.php geändert.

Da nix ging poste ich nun hier... ;)

Gruß
Title: Re: [Mod] Random image / Zufallsbild
Post by: Maweryk on February 12, 2003, 01:31:09 AM
Erst einmal vielen Dank für diesen genialen Mod.

Die Thumbnails werden perfekt auf meiner anderen Website angezeigt.
Es gibt da allerdings noch ein kleines Problem.
Liegt das Thumbnail nicht auf dem 4images-Server, da es von einem User per URL hinzugefügt wurde, wird das Bild natürlich nicht angezeigt. Kann man da evtl. noch eine Abfrage einfügen, die den Ort der thumbnail-Datei bestimmt oder den Code so ändern, dass nur thumbnails angezeigt werden, die auf dem 4images-Server liegen???

Vielen Dank für Eure Hilfe!

Gruß

Markus
Title: Re: [Mod] Random image / Zufallsbild
Post by: rweoli on February 12, 2003, 04:51:08 PM
Okay, wer hat eine funktionierende random.php für mich. Irgendwie akzeptier er den Pfad nicht, egal was ich tue. Wenn ich als root_path den kompletten Pfad nehme, dann funktioniert zwar das Script, aber das Bild wird nicht angezeigt! Kann ich das irgendwie ändern?

Gruß
Title: Re: [Mod] Random image / Zufallsbild
Post by: manica on February 16, 2003, 08:50:53 PM
Habe das mal eingebunden aber kriege da nur folgenden Fehler.


DB Error: Bad SQL Query: SELECT COUNT(*) as total_images FROM 4images_images a, hexboardcategories b WHERE a.image_active=1 AND a.cat_id = b.cat_id AND b.auth_viewcat=0 AND b.auth_viewimage=0
Unknown column 'b.auth_viewcat' in 'where clause'

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 4images_images a, hexboardcategories b WHERE a.image_active=1 AND a.cat_id = b.cat_id AND b.auth_viewcat=0 AND b.auth_viewimage=0 LIMIT 0, 1
Unknown column 'b.auth_viewcat' in 'where clause'


Wobei hexbioardcategorie eun Table vom phpbb ist und nicht von 4images.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Clow Read on February 24, 2003, 01:40:54 AM
could someone help me modify this mod to view only new images from a certain category using V@no's code...

Code: [Select]
<?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/'); // change this to your 4images dir. 
include(ROOT_PATH.'config.php'); 
include(
ROOT_PATH.'includes/db_mysql.php'); 
include(
ROOT_PATH.'includes/constants.php'); 
define('ICON_PATH'ROOT_PATH.TEMPLATE_DIR."/default/icons/"); // path to your template icons. 
$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)) ? 0

function 
get_file_extension($file_name) { 
 
ereg("(.+)\.(.+)"basename($file_name), $regs); 
 return 
strtolower($regs[2]); 

function 
check_thumb_type($file_name) { 
 return (
preg_match('#(gif|jpg|jpeg|png)$#is'$file_name)) ? 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_media_file, 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_extention get_file_extension($row['image_media_file']); 
$image_id $row['image_id']; 
$cat_id $row['cat_id']; 
$image_name $row['image_name']; 
$image_comments $row['image_comments']; 

if (empty(
$row['image_thumb_file'])) { 
 
$thumb_src ICON_PATH."/".$image_extention.".gif"

else { 
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file']; 

if (!
check_thumb_type($image_extention)) { 
 
 $full_src ICON_PATH."/".$image_extention.".gif"

else { 
 
 $full_src = (is_remote($row['image_media_file'])) ? $row['image_media_file'] : ROOT_PATH.MEDIA_DIR."/".$cat_id."/".$row['image_media_file']; 

$full_src_link ROOT_PATH."details.php?image_id=$image_id"
?>

thnx ^_~
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on February 24, 2003, 02:20:24 AM
Code: [Select]
<?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) fur    *
*  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/'); // change this to your 4images dir.
include(ROOT_PATH.'global.php');
$new_cutoff time() - 60 60 24 $config['new_cutoff'];
$sql "SELECT IF(a.image_date >= $new_cutoff,RAND()+1,1) as random_no, a.image_id, a.cat_id, a.image_name, a.image_active, a.image_media_file, a.image_thumb_file, a.image_comments, a.user_id
        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 random_no DESC, RAND()
        LIMIT 1"
;
$row $site_db->query_firstrow($sql);
$image_extention get_file_extension($row['image_media_file']);
$image_id $row['image_id'];
$cat_id $row['cat_id'];
$image_name $row['image_name'];
$image_comments $row['image_comments'];

if (empty(
$row['image_thumb_file'])) {
$thumb_src ICON_PATH."/".$image_extention.".gif";
}
else {
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
}
if (!
check_thumb_type($image_extention)) {
 
 $full_src ICON_PATH."/".$image_extention.".gif";
}
else {
 
 $full_src = (is_remote($row['image_media_file'])) ? $row['image_media_file'] : ROOT_PATH.MEDIA_DIR."/".$cat_id."/".$row['image_media_file'];
}
$full_src_link ROOT_PATH."details.php?image_id=$image_id";
?>

it will chose an image from new images, but if there is no new images, it will chose random from whole gallery.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Chris72 on February 27, 2003, 02:37:12 AM
Erst einmal Kompliment für das tolle Script, das im grossen und ganzen auch toll läuft. Allerdings habe ich ein Problem, was zwar nicht am Script liegt, aber vielleicht fällt jemanden eine Lösung ein:

Ich würde gerne das Zufallsbild gerne in mein Guestbook (MySQL/PHP) integrieren, allerdings lassen die Templates keinen PHP-Code zu :cry: Gibt es vielleicht einen Trick wie man trotzdem das Zufallsbild integrieren könnte? Bisher habe ich leider noch keine Lösung gefunden....
Title: Re: [Mod] Random image / Zufallsbild
Post by: fabulous on February 27, 2003, 08:27:55 PM
hi.

the script v@no posted was exactly was i was trying to find in this board here. i would like to get a random foto, but not out of the whole gallery but only the new ones. so i thought v@nos code was right but when i uploaded that php page and started it in my browser, the only source code it created was:
Code: [Select]
<html><body></body></html>
i changed the 4images path to the same i used in the original random php script.
still the same error.
see it here on this page:
http://www.odd-fish.de/randomnew.php

original random script:
http://www.odd-fish.de/random.php

anyone an idea ?

cheers, fab
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on February 28, 2003, 12:02:39 AM
Quote from: fabulous
hi.

the script v@no posted was exactly was i was trying to find in this board here. i would like to get a random foto, but not out of the whole gallery but only the new ones. so i thought v@nos code was right but when i uploaded that php page and started it in my browser, the only source code it created was:
Code: [Select]
<html><body></body></html>
i changed the 4images path to the same i used in the original random php script.
still the same error.
see it here on this page:
http://www.odd-fish.de/randomnew.php

original random script:
http://www.odd-fish.de/random.php

anyone an idea ?

cheers, fab


my code works different way then original.
read here how to use it:
http://4homepages.de/forum/viewtopic.php?p=12102#12102

P.S. u can not use it from .html page, only from .php
Title: Re: [Mod] Random image / Zufallsbild
Post by: ruck on February 28, 2003, 08:23:55 AM
I've tried this mod and it works fine except when there isn't a thumbnail it doesn't seem to display anything at all, not even the default image. Anyway to get it to do that?
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on February 28, 2003, 09:42:30 AM
Quote from: ruck
I've tried this mod and it works fine except when there isn't a thumbnail it doesn't seem to display anything at all, not even the default image. Anyway to get it to do that?

if you would read through the whole posts in this thread, u'd found your answer.  :roll:
btw, I posted in my previous replay the link to it  :roll:
Title: Re: [Mod] Random image / Zufallsbild
Post by: fabulous on February 28, 2003, 09:44:37 AM
works perfect now, thx a lot V@no !!!   :D  :D
Title: Re: [Mod] Random image / Zufallsbild
Post by: ruck on March 08, 2003, 11:57:11 PM
Okay, sorry V@no. I got it working now and it displays the default image now. :) Thanks for that.

Is there any way to display multiple random images with your script? Sorry if this has already been answered. I tried to find it in the thread but it's very long and gets confusing because I only speak English.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Amosnet on March 10, 2003, 10:30:12 PM
Was hat Matthias 70 hier geändert damit es läuft.
Ich will den Kategorienamen anzeigen lassen!!!!

Quote from: Matthias70
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
Title: Re: [Mod] Random image / Zufallsbild
Post by: Amosnet on March 10, 2003, 11:38:43 PM
Man muss unter:

Code: [Select]
$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, b.cat_name

Anfügen:
Code: [Select]
b.cat_name

dann ein bischen weiter unten:
Code: [Select]

$cat_name = $row['cat_name'];

Und das ist dann die Ausgabe:
Code: [Select]

echo "Kategorie:<br><a href=\"".ROOT_PATH."categories.php?cat_id=$cat_id\">\n";
echo "$cat_name<br></a>\n";
[/code]
Title: Re: [Mod] Random image / Zufallsbild
Post by: PREACHER on March 23, 2003, 12:52:42 PM
Ich hätte da mal ne frage ist es möglich die Random funktion in script mit den neuen Bildern zu verbinden wenn ja wie?  :?:
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on March 23, 2003, 01:21:44 PM
Quote from: PREACHER
Ich hätte da mal ne frage ist es möglich die Random funktion in script mit den neuen Bildern zu verbinden wenn ja wie?  :?:

sorry if  I missaderstud u ;)
http://4homepages.de/forum/viewtopic.php?p=17715#17715
Title: Re: [Mod] Random image / Zufallsbild
Post by: FreDyz on March 28, 2003, 06:18:19 PM
Thanks for this MOD, it works fine! :)

I would want to know if it would be possible that the MOD shows a  random image of a certain member , or the last image added to the gallery (globally or the last image added by a certain member).

I think that this is possible with mySQL queries but I dont know anything of mySQL.

Anybody can help me?

Thanks
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on March 28, 2003, 11:45:55 PM
Quote from: FreDyz
I would want to know if it would be possible that the MOD shows a  random image of a certain member , or the last image added to the gallery (globally or the last image added by a certain member).

"last image added"? if u are talking about random image from "new" images, then I belive the changes were posted inbetween the replays.
if u want show random image from only one user, then try to change the original code:
Code: [Select]
$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";

to this:
Code: [Select]
$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.user_id
        FROM ".IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
        WHERE a.image_active=1
        AND a.user_id = XXXXX
        AND a.cat_id = b.cat_id
        AND b.auth_viewcat=".AUTH_ALL."
        AND b.auth_viewimage=".AUTH_ALL."
        LIMIT $number, 1";

change XXXXX to your user's ID number

P.S. I havent test this, just an idea ;)
Title: Re: [Mod] Random image / Zufallsbild
Post by: Vicky on April 03, 2003, 03:05:08 PM
Erst einmal VIELEN DANK für das Script. Dat iss super und *man höre und staune* es hat FAST auf Anhieb funktioniert.

Nun ja... ich habe da eine eher bescheidene Frage... (an der ich jetzt schon länger sitze, als am Script zurechtbasteln selbst... und dat nervt mich... daher frag ich...)

Ich binde die random.php via IFrame in eine Box auf meinem Portal ein. Mein Problem ist, dass das Bild im IFrame rechtsbündig angezeigt wird. Ich hätte es so gern mittig...

der Code des IFrames sollte eigentlich sowas von stimmen...



Code: [Select]
<p align="center">
<iframe scrolling="no" align="center" border="0" frameborder="0" src="http://www.meine Domain.de/random.php" width="130" height="165">
</iframe></p>


Ich tippe daher mal darauf, dass ich das in der random.php ändern muss...

Der Ausgabeteil ...echo   blabla... ist ebenfalls mit gecenterten Tags ausgestattet... Wo könnte ich denn noch "centerse" unterbringen, damit das Bild mittig angezeigt wird???

Vielen Dank für Eure Hilfe...

Liebe Grüße,

Vicky


PS.: ich wette, sobald ich auf "absenden" klicke, klickt es auch bei mir...
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on April 03, 2003, 03:33:19 PM
try to repalace:
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";
echo "<b>$image_name</b><br>\n";
echo "Comments: $image_comments<br>\n";

with this:
Code: [Select]
echo "<table width=\"100%\" border=\"0\" cellpading=\"0\" cellspacing=\"0\">\n<tr>\n<\td width=\"130\" height=\"165\" align=\"center\" valign=\"center\">";
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 "</td>\n</tr>\n</table>\n";
Title: Re: [Mod] Random image / Zufallsbild
Post by: Vicky on April 03, 2003, 03:51:12 PM
Hallo V@no

vielen Dank für Deine schnelle Hilfe...

Leider mag die Box dat nicht so gern...

Ich bekommen angezeigt:

< d width="130" height="165" align="center" valign="center">

dann das Bild RECHTSBÜNDIG  :cry:

Da fehlt irgend wo ein Koma oder es ist ein Strich zu viel... *such*

Liebe Grüße,

Vicky
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on April 03, 2003, 05:16:44 PM
sorry, typo  :?
remove this:
Quote
echo "<table width=\"100%\" border=\"0\" cellpading=\"0\" cellspacing=\"0\">\n<tr>\n<\td width=\"130\" height=\"165\" align=\"center\" valign=\"center\">";
Title: Re: [Mod] Random image / Zufallsbild
Post by: Silaz on April 05, 2003, 01:51:43 AM
Hallo ich wusste nicht ob ich ein neuen Thread aufmachen sollte.

Hier ist eine fertige version von der random_more_pics.txt für das IPB 1.1.1 MOD Portal Beta 2 von Dragoran hier zu finden (http://www.ibplanet.de/forums/index.php?act=downloads&CODE=02&id=4) (Achtung um das zu sehen muss man da eingeloggt sein)


Ein paar ergänzungen hab ich vorgenommen.

Angezeigt wird ...
- Name
- Hits
- Downloads
- Bewertung (gesamt)
- Beschreibung
- Kommentare


Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File&#58; random_more_pics.php                                 *
 *        Copyright&#58; &#40;C&#41; 2002 Jan Sorgalla                                *
 *            Email&#58; jan@4homepages.de                                    *
 *              Web&#58; http&#58;//www.4homepages.de                             *
 *    Scriptversion&#58; 1.0 for 4images 1.6.1                                *
 *                                                                        *
 *    Never released without support from&#58; Nicky &#40;http&#58;//www.nicky.net&#41;   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen &#40;http&#58;//www.4homepages.de/4images/lizenz.php&#41; für       *
 *    weitere Informationen.                                              *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    &#40;http&#58;//www.4homepages.de/4images/lizenz_e.php&#41; for further         *
 *    information.                                                        *
 *                                                                        *
 *************************************************************************/

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define&#40;'ROOT_PATH', './4images/'&#41;;

include&#40;'/homepages/11/XXXXXXXXXX/4images/config.php'&#41;;
include&#40;'/homepages/11/XXXXXXXXXX/4images/includes/db_mysql.php'&#41;;
include&#40;'/homepages/11/XXXXXXXXXX/4images/includes/constants.php'&#41;;

$site_db = new Db&#40;$db_host, $db_user, $db_password, $db_name&#41;;
function is_remote&#40;$file_name&#41; &#123;
  
return &#40;preg_match&#40;'#^https?\\&#58;\\/\\/[a-z0-9\-&#93;+\.&#40;[a-z0-9\-&#93;+\.&#41;?[a-z&#93;+#i', $file_name&#41;&#41; ? 1 &#58; 0;
&#125;

// 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, a.image_rating, a.image_votes, a.image_hits, a.image_downloads, a.image_description    
        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 RAND&#40;&#41; 
        LIMIT 
$num_images";
$result $site_db->query&#40;$sql&#41;;

while &#40;$row = $site_db->fetch_array&#40;$result&#41;&#41;&#123;
  
$image_id $row['image_id'&#93;;
  
$cat_id $row['cat_id'&#93;;
  
$image_votes $row['image_votes'&#93;;
  
$image_hits $row['image_hits'&#93;;
  
$image_downloads $row['image_downloads'&#93;;
  
$image_name $row['image_name'&#93;;
  
$image_rating $row['image_rating'&#93;;
  
$image_description  $row['image_description'&#93;; 
  
$image_comments $row['image_comments'&#93;;
  
$thumb_src = &#40;is_remote&#40;$row['image_thumb_file'&#93;&#41;&#41; ? $row['image_thumb_file'&#93; &#58; ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'&#93;;

echo "<table width=\"100%\" border=\"0\"><tr>";
echo 
"<td width=\"41%\"><div align=\"center\"><a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a></div></td>";
echo 
"<td width=\"59%\"><p><strong>Name&#58;</strong> $image_name<strong><br>";
echo 
"Hits&#58; </strong>$image_hits<strong><br>";
echo 
"Downloads&#58; </strong>$image_downloads<strong><br>";
echo 
"Bewertungen&#58; </strong>$image_rating &#40;von $image_votes&#41;<br>";
echo 
"<strong>Beschreibung&#58; </strong>$image_description<strong></strong> </p>";
echo 
"<p><strong>Kommentare&#58;</strong> $image_comments<br>";
echo 
"[<a href=\"".ROOT_PATH."details.php?image_id=$image_id\">Vergr&ouml;ssern</a>&#93;";
echo 
"</p></td></tr><tr><td colspan=\"2\"><hr  color=\"#465584\" width=\"90%\" size=\"1\"></td></tr></table>\n";
&
#125;
?>



Anleitung:

1. Kompletten Code Kopieren und als Random.php speichern!
2. den PFAD zur 4images Gallerie eintragen.
3. Die anzahl der Bilder eingeben die Angezeigt werden sollen.
4. Speichern und ins Hauptverzeichnis 4images hochladen
5. ACP -> Portal PHP Box erstellen.

Das eintragen...
Code: [Select]
include("http://www.deine_url.de/4images/random.php");


Fertig!

Achtung: es passt nur in die Mitte da der Text rechts neben dem Bild angezeigt wird. Falls jemand was  nicht möchtest muss er einfach im echo Teil unten endfernen.


@Jan

Is das ok wenn ich das auch  in die IPB Foren als MOD poste?
Nein ich will es nicht als meins ausgeben... dazu fehlt mir PHP verständnis :)
Title: Re: [Mod] Random image / Zufallsbild
Post by: PREACHER on April 09, 2003, 05:25:36 PM
Hi kann mann diesen mod innerhalb des scriptes nutzen und trotzdem die Randomnewpics funktion haben? D.h. daß die neuen pics abwechselnd geziegt werden?  :?
Title: Re: [Mod] Random image / Zufallsbild
Post by: OperaDivaMommy on April 22, 2003, 08:24:58 AM
This mod worked straight away for me!  Thanks VERY much!

Laura
(see the gallery for my little girl here: http://www.incredesign.com/megan/
Title: Re: [Mod] Random image / Zufallsbild
Post by: swifter_uk on April 29, 2003, 09:50:06 PM
Is it possible for me to add to the random.php script a line to open the random image in a new window when a user clicks on it?
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on April 30, 2003, 12:53:12 AM
Quote from: swifter_uk
Is it possible for me to add to the random.php script a line to open the random image in a new window when a user clicks on it?

add target='_blank' inside <a href link
for example <a href='address' target='blank'><img src...></a>
Title: Re: [Mod] Random image / Zufallsbild
Post by: swifter_uk on April 30, 2003, 01:00:17 AM
Sorry confuses me a bit!

img src is set from Gallery's random image, "address"? should this be of my gallery?

Sorry, but no experience of PHP script's.

Mike.

Here is the address where I am testing random image, see what happens if it is clicked on! http://www.hovegallery.co.uk/Gallery/Random.htm
Title: Re: [Mod] Random image / Zufallsbild
Post by: Reini on April 30, 2003, 09:28:43 PM
Hi all
Wie muss ich den der Link aussehen wenn ich das zufallsbild den jeweiligen Boardstyle anpassen will ? (wbb2)

Code: [Select]
echo "<a href=\"".ROOT_PATH."details.php?image_id=$image_id\" target=\"_new\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a>\n";
Title: Re: [Mod] Random image / Zufallsbild
Post by: swifter_uk on May 01, 2003, 02:27:27 AM
Quote from: V@no
Quote from: swifter_uk
Is it possible for me to add to the random.php script a line to open the random image in a new window when a user clicks on it?

add target='_blank' inside <a href link
for example <a href='address' target='blank'><img src...></a>


Can anyone help me on how I should add this code to make the image open in a new window?
Title: Re: [Mod] Random image / Zufallsbild
Post by: swifter_uk on May 03, 2003, 12:51:33 AM
:D Thanks to v@no, his patience with me has got this working for me at last, so simple but so am I sometimes!!! :oops:
Title: Re: [Mod] Random image / Zufallsbild
Post by: brutha on May 16, 2003, 03:44:04 AM
Now i really read through all of these pages, but it seems, my problem is not detailed here.

I can add a single picture to my homepage and I can add multiple pictures under each other using the "multiple" version.

But what to do if I try to get 3 pictures from 3 different categories next to each other in one line?
A possibility for doing this with seperate includes to use it in a table would be best.

is there anything I can do for this?

here's the link to show you what I mean

http://www.abiwolnzach02.com/indexnew.php

TIA folks!

You're doing a great job, expecially in support!
Title: Re: [Mod] Random image / Zufallsbild
Post by: stipko on April 26, 2005, 01:15:25 PM
Is there a similar mod/php for 1.7.1 ?

I'd like to insert a random thumb and description into my webpages, on the same server, but outside of the 4images program.

Thanks!!
Title: Re: [Mod] Random image / Zufallsbild
Post by: stipko on April 26, 2005, 09:59:37 PM
Hello,

Thanks for this mod. Exactly what I needed. May I ask; How can I modify this so that it displays images even when a user is not logged in or the category is only available to 'registered' users?

In other words, all of my images require registration, but I'd like to include this random.php in other webpages that non-users see. It's OK if they cant see the full 4images details page, but just the thumbnail and description. Does that make sense?

here we go:
http://www.nicky.net/4images/random_full.txt

have fun
Title: Re: [Mod] Random image / Zufallsbild
Post by: stipko on April 28, 2005, 09:28:11 AM
Anyone?
Title: Re: [Mod] Random image / Zufallsbild
Post by: gallito on May 01, 2005, 11:18:16 PM
Hello,

Thanks for this mod. Exactly what I needed. May I ask; How can I modify this so that it displays images even when a user is not logged in or the category is only available to 'registered' users?

In other words, all of my images require registration, but I'd like to include this random.php in other webpages that non-users see. It's OK if they cant see the full 4images details page, but just the thumbnail and description. Does that make sense?

here we go:
http://www.nicky.net/4images/random_full.txt

have fun



Yes... I have the same doubt   :cry:
Title: Re: [Mod] Random image / Zufallsbild
Post by: kashiftiwana on May 17, 2005, 08:40:25 AM
hi
thanx for the mod, working fine in test.php, but when i call this mod in postnuke php block i got this error
Code: [Select]
DB Error: Could not connect to the database server (, )..
any help?
i also tried to download postnuke module which is mention in this forum but its not avilable any more on the that site http://www.netforum.com, if any one have that mod plz, i want  :(
Title: Re: [Mod] Random image / Zufallsbild
Post by: Vincent on May 17, 2005, 11:33:28 PM
Hello
i have installed this mod - which is not working - but sins i install it - the checkimages.php is not working anymore?
i don't know if this is just unlucky or if the

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

modifeyes something else
hope of feedback
vincent
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on May 18, 2005, 12:48:30 AM
mmm....what this mod has anything to do with checkimages.php?
where did u include the random.php ??? 8O
perhaps u missunderstood the purpose of this mod - display a random image ON EXTERNAL PAGE (not on 4images-based pages) ?
and because of that there is no 4images files should be changed for this mod...
Title: Re: [Mod] Random image / Zufallsbild
Post by: kashiftiwana on May 18, 2005, 11:50:22 PM
Hi V@no
 :( what about my problem, a try many ways, but nothing happens on postnuke site, i crated a test.php page outside of postnuke root path, there it will show me random images, but when i call script in postnuke page , i got this message.
Code: [Select]
DB Error: Could not connect to the database server (, )..   :( any help plz, may be i miss something in this post, but i dont know german, i also tried to translate these german post into english, but cannot get help  :( :( :(, any one, any help
Title: Re: [Mod] Random image / Zufallsbild
Post by: mastidude on May 24, 2005, 09:24:16 PM
Hello please

I installed the RANDOM MORE PIX MOD(allows more than 1 thumbnail) ,The problem is the  images are coming Vertically,how do I make them horizonatlly to be dispalyed on my web page?

Thanx in advance
Title: Re: [Mod] Random image / Zufallsbild
Post by: AntiNSA2 on June 08, 2005, 08:14:29 PM
Hi-

Ok, as I try to integrate this with wbb 2.3.2 I have a problem-

I have created this random.php and in it stands this

<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: random_full.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黵       *
 *    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
define('ROOT_PATH', '../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_media_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'];
$full_src = (is_remote($row['image_media_file'])) ? $row['image_media_file'] : ROOT_PATH.MEDIA_DIR."/".$cat_id."/".$row['image_media_file'];

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



my 4images directory

www.thecenterofthenet.com/4images/

my wbb

www.thecenterofthenet.com/ww2/

in my index template I have created this:

<SCRIPT language='JavaScript'  src='http://thecenterofthenet.com/wbb2/random.php'></SCRIPT>


The problem is that I get the link, however no image.

It seems to me somthing is wrong with the thumbnail source. However, since the paths seem to be correct why isnt it finding the thumbnail source?

I mean, if you want to see the error you can check out www.thecenterofthenet.com/wbb2/

underneath the login window you can see the correct link to the details.

Site is under heavy constriction.

Thanks-

Robert
Title: Re: [Mod] Random image / Zufallsbild
Post by: B.C on June 08, 2005, 08:19:37 PM
hi ich bin neu hier und absoluter newbie und bräuchte hilfe. wäre SUPER wenn ihr mir helfen könntent

ich hab das auch probiert, das ein zufallsbild auf meiner seite erscheint.. weis jedoch nicht so recht wie genau das funktioniert... meine hauptseite ist eine html seite.. hoffe das macht nichts... sie ist im mom auch noch nicht hochgeladen, weil ich dafür noch ein bisschen brauche bis die fertig ist....

aber wie genau muss ich das anstellen..?
hab also diese random.php seite runtergeladen und geöffnet.. welche änderungen muss ich da genau vornehmen, damit dann ein Zufallsbild auf der hp erscheint?

Möchte das Zufallsbild mit Inlineframes unter meiner späteren navigation einbinden...

die random.php hab ich jetzt mal normal in meinen 4images ordner geladen (also in keinen unterordner).

wäre seeeeehhr dankbar wenn ihr auch mir helfen könntet

mfg
Title: Re: [Mod] Random image / Zufallsbild
Post by: glitzer on June 12, 2005, 11:35:53 AM
Hello,

It works perfectly, but i want to show more than 1 random picture.
I would like to show 4 or 5 different random pictures next to each other

Can anybody help me??
Thanx a lot
Title: Re: [Mod] Random image / Zufallsbild
Post by: fotograf74 on June 14, 2005, 10:31:20 PM
Thank you for the Code.

I display 4random  images and want to show this images in horizontal form. Now I have it in vertical direction.

What must i do?
Title: Re: [Mod] Random image / Zufallsbild
Post by: trunky on June 26, 2005, 04:00:18 PM
It works fine for me - BUT it shows only one "random" pic, always the same  :( After Reloading etc, every time the same pic  :(
Title: Re: [Mod] Random image / Zufallsbild
Post by: maikew on June 26, 2005, 04:47:56 PM
hi ich bin neu hier und absoluter newbie und bräuchte hilfe. wäre SUPER wenn ihr mir helfen könntent

ich hab das auch probiert, das ein zufallsbild auf meiner seite erscheint.. weis jedoch nicht so recht wie genau das funktioniert... meine hauptseite ist eine html seite.. hoffe das macht nichts... sie ist im mom auch noch nicht hochgeladen, weil ich dafür noch ein bisschen brauche bis die fertig ist....

aber wie genau muss ich das anstellen..?
hab also diese random.php seite runtergeladen und geöffnet.. welche änderungen muss ich da genau vornehmen, damit dann ein Zufallsbild auf der hp erscheint?

Möchte das Zufallsbild mit Inlineframes unter meiner späteren navigation einbinden...

die random.php hab ich jetzt mal normal in meinen 4images ordner geladen (also in keinen unterordner).

wäre seeeeehhr dankbar wenn ihr auch mir helfen könntet

mfg

hi,

also in der random.php folgende root einstellung eintragen define('ROOT_PATH', './'); da sich die random.php ja im 4images ordner befindet.

die index.html seite in index.php umbenennen(html funkt nicht) und mit diesem befehl einbinden

<?php
include("/4images/random.php");
?>

oder

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

speicherst du die random.php in dem verzeichnis wo deine hauptseite ist (dort wo die pics erscheinen sollen dann reicht dieser befehl

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

und den root pfad define('ROOT_PATH', '/4images/'); so umbenennen

ich hoffe ich hab alles richtig erklärt  :oops: bin selbst noch recht neu auf diesem gebiet ;) falls etwas falsch sein sollte bitte berichtigt mich dann ruhig *g*
Title: Re: [Mod] Random image / Zufallsbild
Post by: maikew on June 26, 2005, 04:55:36 PM
Hello,

It works perfectly, but i want to show more than 1 random picture.
I would like to show 4 or 5 different random pictures next to each other

Can anybody help me??
Thanx a lot

this is my random_morepics.php .mod created by nicky

Code: [Select]
<?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''../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)) ? 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 RAND() 
        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=\"0\" alt=\"$image_name\"></a><br>\n";
  echo 
"<b>$image_name</b><br>\n";
  echo 
"Comments: $image_comments<hr>\n";
}
?>
Title: Re: [Mod] Random image / Zufallsbild
Post by: Loet on July 17, 2005, 09:55:07 PM
Thank you for the Code.

I display 4random  images and want to show this images in horizontal form. Now I have it in vertical direction.

What must i do?

 :?: Anyone with the solution to show them horizontal (in a table) instead of vertical?
Looked in the code of 4images to figure out how it creates e.g. the thumbnails in a table but did not get me anywhere. :(



Title: Re: [Mod] Random image / Zufallsbild
Post by: fotograf74 on July 19, 2005, 06:30:04 PM
I have another question. I write it here, because I didn´t find any similiar topic.

I want to integrate the pictures from the "Categories" in another Website with a other domain.


How can I realize this?
Title: Re: [Mod] Random image / Zufallsbild
Post by: fiskedagboken on July 20, 2005, 02:21:48 PM
Thank you for the Code.

I display 4random  images and want to show this images in horizontal form. Now I have it in vertical direction.

What must i do?

 :?: Anyone with the solution to show them horizontal (in a table) instead of vertical?
Looked in the code of 4images to figure out how it creates e.g. the thumbnails in a table but did not get me anywhere. :(





I don´t know wich random.php u are using, but the originial has an echo command with a <br> tag  in the end. I have´nt test this mod yet, but it might work if u remove that tag.

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


ALWAYS backup your file first, I might be totaly wrong.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Loet on July 21, 2005, 12:38:18 AM
Thanks,

A simple solution, did not see it myself.
It does not create a table but I think I can do something with it...

Loet
Title: Re: [Mod] Random image / Zufallsbild
Post by: mister pink on July 23, 2005, 03:14:43 PM
hello

i'm sorry if this question has allready been posted (and answer .. ) but after many reshearch i don't find it (or if it will be answered in german .. i don't understand it .. orry)

I would like mke change to get a random image from the entire site enven if i'm in categorie and sub categorie
Cause i'm making a photo gallery with 2 others people .. and i would alow thier pic being display in the random box even if user is surfing in my cat

thx for all (and sorry for my crappy english)

*solve .. by changing 2 lines un categorie.html .. sorry  :mrgreen:
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on July 23, 2005, 07:37:20 PM
this question has nothing to do with the mod (if I understood you correctly). All u need to do is replace any {random_cat_image} tags in the templates with {random_image}
Title: Re: [Mod] Random image / Zufallsbild
Post by: IceS on July 24, 2005, 10:50:27 PM
Wenn ich die Rendem.php aufrufe bekomme ich nur eine Fehlermeldung:

Fatal error: Cannot instantiate non-existent class: db in /usr/export/www/hosting/ices/random.php on line 34

Bitte helft mir
Title: Re: [Mod] Random image / Zufallsbild
Post by: GreekGoddess on August 04, 2005, 07:19:05 AM
Ok I am browsing through this thread for hours and I a meither blind or too tired so forgive me.

my random.php is located in http://www.irishbreen.com/

my gallery in http://www.irishbreen.com/photos/

My random.php code is this

Code: [Select]
<?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''./photos/');

include(
ROOT_PATH.'config.php');
include(
ROOT_PATH.'includes/db_mysql.php');
include(
ROOT_PATH.'includes/constants.php');
define('SCRIPT_URL''http://www.irishbreen.com/photos/');
$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)) ? 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 
"<a href=\"".SCRIPT_URL."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";
?>



but when I click on random.php it shows red X's and the source code I get is
Code: [Select]
<a href="http://www.irishbreen.com/photos/details.php?image_id="><img src="http://www.irishbreen.com/photos/data/thumbnails//" border="0" alt=""></a><br>
<b></b><br>
Comments: <br>

it seems that it cant find the image_id for some reason. Any ideas ?
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on August 04, 2005, 08:05:11 AM
that's because u cant see any images if u are not logged in (visiting as a guest)
you'll need either remove completly two instances of these two lines:
Code: [Select]
        AND b.auth_viewcat=".AUTH_ALL."
        AND b.auth_viewimage=".AUTH_ALL."
or replace them with:
Code: [Select]
        AND b.auth_viewcat<".AUTH_ADMIN."
        AND b.auth_viewimage<".AUTH_ADMIN."
The first variant will not check any permissions of the categories and second will not show images from categories where only admin is allowed to see.
Title: Re: [Mod] Random image / Zufallsbild
Post by: GreekGoddess on August 04, 2005, 08:56:43 AM
thanks V@no that worked liek a charm!!!
Title: Re: [Mod] Random image / Zufallsbild
Post by: Honey on August 05, 2005, 11:54:06 PM
How I can make it work? I have this thing on my index page -

Code: [Select]
Warning: main(http://gilmore-girls.frihost.net/www/gallery/http://gilmore-girls.frihost.net/www/gallery/config.php): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/aalia/public_html/random.php on line 30

Warning: main(): Failed opening 'http://gilmore-girls.frihost.net/www/gallery/http://gilmore-girls.frihost.net/www/gallery/config.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/aalia/public_html/random.php on line 30

Warning: main(http://gilmore-girls.frihost.net/www/gallery/http://gilmore-girls.frihost.net/www/gallery/includes/db_mysql.php): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/aalia/public_html/random.php on line 31

Warning: main(): Failed opening 'http://gilmore-girls.frihost.net/www/gallery/http://gilmore-girls.frihost.net/www/gallery/includes/db_mysql.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/aalia/public_html/random.php on line 31

Warning: main(http://gilmore-girls.frihost.net/www/gallery/http://gilmore-girls.frihost.net/www/gallery/includes/constants.php): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/aalia/public_html/random.php on line 32

Warning: main(): Failed opening 'http://gilmore-girls.frihost.net/www/gallery/http://gilmore-girls.frihost.net/www/gallery/includes/constants.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/aalia/public_html/random.php on line 32

Fatal error: Cannot instantiate non-existent class: db in /home/aalia/public_html/random.php on line 34
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on August 06, 2005, 04:11:34 AM
the root path u specifyed doesnt look as a correct path:
Quote
http://gilmore-girls.frihost.net/www/gallery/http://gilmore-girls.frihost.net/www/gallery/
its not internet path, its RELATIVE (./ and/or ../) type of path
Title: Re: [Mod] Random image / Zufallsbild
Post by: Colourconcept on August 10, 2005, 08:08:49 AM
Moin,
dann will ich mich auch mal in diesen Mega-Thread reinhängen, der verdammt schwer zu verfolgen ist...  :roll:

Vorab vielen Dank an Nicky für die Mod-Datei. Ist genaus das, was ich gesucht habe. Leider bekomme ich das Teil aber nicht so recht zum laufen.

Die random.php liegt auf meiner HP im Hauptverzeichnis. Wenn ich sie direkt über die URL aufrufe, bekomme ich das Zufallsbild auch angezeigt.
Die 4images-Galerie liegt in einem Ordner im Hauptverzeichnis meiner HP. Der Pfad in der random.php ist daher wie folgt definiert:

Quote
// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH', './4images/');

include(ROOT_PATH.'config.php');
include(ROOT_PATH.'includes/db_mysql.php');
include(ROOT_PATH.'includes/constants.php');
define('SCRIPT_URL', 'http://www.Colourconcept.net/4images/');

Die zweite Pfadbeschreibung die hier im Thread auftaucht, habe ich also auch schon integriert. Auf meiner Postnuke-Seite möchte ich das Zufallsbild in einem Block am rechten Seitenrand anzeigen. Ich habe daher dort einen php-Block generiert und die random.php mit dem folgenden Befehl eingebunden:

Quote
include("random.php");

Leider führt das aber nicht zum gewünschten Ergebnis. Es wird nichts angezeigt :( Ändere ich etwas in der random.php oder im include-Befehl, bekomme ich allerdings sofort Fehlermeldungen. Hat jemand 'ne Idee, wo mein Problem liegt?

Besten Dank vorab
Title: Re: [Mod] Random image / Zufallsbild
Post by: Buzzdee on August 12, 2005, 04:04:50 PM
Hallo,

also, ich würde das random_mod auch gerne nutzen, habe dabei folgende Probleme:

Einbindung mit include in sidebar.php (www.one-brain-cellers.de/wordpress/wp-content/themes/rin/sidebar.php)  :
Warning: main() [function.main]: open_basedir restriction in effect. File(/usr/lib/php/random.php) is not within the allowed path(s): (/home/www/htdocs/one-brain-cellers.de/.) in /home/www/htdocs/one-brain-cellers.de/wordpress/wp-content/themes/rin/sidebar.php on line 32

Warning: main(random.php) [function.main]: failed to create stream: Operation not permitted in /home/www/htdocs/one-brain-cellers.de/wordpress/wp-content/themes/rin/sidebar.php on line 32

Warning: main() [function.main]: Failed opening 'random.php' for inclusion (include_path='.:/usr/lib/php') in /home/www/htdocs/one-brain-cellers.de/wordpress/wp-content/themes/rin/sidebar.php on line 32

Einbindung mit iFrame:
Security violationSecurity violation
Fatal error: Cannot instantiate non-existent class:db in /home/www/htdocs/one-brain-cellers.de/wordpress/wp-content/themes/rin/random.php on line 35


random.php :
Code: [Select]
define('ROOT_PATH', 'http://www.one-brain-cellers.de/4images/');
include(ROOT_PATH.'config.php');
include(ROOT_PATH.'includes/db_mysql.php');
include(ROOT_PATH.'includes/constants.php');
define('SCRIPT_URL', 'http://www.one-brain-cellers.de/4images/');
.
.
.
$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";?>

random.php liegt auf www.one-brain-cellers.de/wordpress/wp-content/themes/rin/
4images auf www.one-brain-cellers.de/4images

Das mit dem include-Befehl scheint ein Problem mit meinem Webspace zu sein, das funktioniert generell nicht. Auch die hier vorgestellte Java Variante funktioniert nicht (passiert garnichts).

Kann mir jemand bitte helfen?

Liebe Grüße
Buzzdee
Title: Re: [Mod] Random image / Zufallsbild
Post by: maikew on August 21, 2005, 03:38:13 PM
hallo buzzdee

deine random.php liegt im falschen ordner.sie muss in den hauptordner des blogs kopiert werden ;) nicht in
den theme ordner.
und dieser abschnitt in der random php muss dann wie folgt lauten
define('ROOT_PATH', '../4images/');

hier kannst du es dir ansehen http://maikew.ma.funpic.de/blog/  :wink:
Title: Re: [Mod] Random image / Zufallsbild
Post by: okasa on August 26, 2005, 04:14:17 AM
Quote
:?: Anyone with the solution to show them horizontal (in a table) instead of vertical?
Looked in the code of 4images to figure out how it creates e.g. the thumbnails in a table but did not get me anywhere. :(

I use this code to keep them horizonal

  echo "<table border='0' width='133' bgcolor='#FFFFFF' Align=left>\n";
  echo "<TR>\n";
  echo "<TD><a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a></TD>\n";
  echo "</TR>\n";
  echo "<TR>\n";
  echo "<TD bgcolor='#FFFFFF'><b>$image_name</b></TD>\n";
  echo "</TR>\n";
  echo "<TR>\n";
  echo "<TD bgcolor='#FFFFFF'>Comments: $image_comments</TD>\n";
  echo "</TR>\n";
  echo "</table>\n";
Title: Re: [Mod] Random image / Zufallsbild
Post by: rosablasiclub on September 13, 2005, 06:02:33 PM
It works fine for me - BUT it shows only one "random" pic, always the same  :( After Reloading etc, every time the same pic  :(

I have this problem too, does anyone know why that would be? My code is on here: http://www.dhost.info/rosablasiclub/home.php (it's a test page for a new version right now)
Title: Re: [Mod] Random image / Zufallsbild
Post by: rosablasiclub on September 14, 2005, 10:54:19 PM
Could someone pleeeease help me with this? I'm done with the rest of the site and I am just waiting for this to be fixed so I can put all of it online.. my random.php code is as follows:

Code: [Select]
<?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''../rosablasiclub/archive/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)) ? 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\" target=\"_blank\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"random picture\"></a><br>\n";
?>

Title: Re: [Mod] Random image / Zufallsbild
Post by: D3RB on September 15, 2005, 04:51:01 PM
hi,
ich bin auch ein großer fan der gallery hochachtung an die macher.

so jetzt zum eigentlichen problem:

ich habe meine hp mit dem clan manager pro gemacht und dort gefällt mir das mit dem potm nicht, weil man dort jedes einzelne bild zuweisen muss was in der box angezeigt werden soll, nun hab ich mir die random.php runtergeladen soweit auch alles umeditiert, sie funzt auch soweit aber wenn ich sie einbinden will dann verzieht mein ganzes style, weiß einer dazu rat? hab mit ifram sowie include gearbeitet

hier meine random.php

Code: [Select]
<?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/');

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)) ? 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\" target=\"_new\"><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";
?>


aso bevor ich es vergesse das design wird in 2 php dateien gesplittet aus der html

die sich footer und header nennen

hoffe mir kann einer helfen


hier der link

www.ph-multigaming.de.vu

nich wundern ich nutz im moment wieder das potm von dem script
Title: Re: [Mod] Random image / Zufallsbild
Post by: D3RB on September 15, 2005, 11:38:03 PM
so habs von allein hinbekommen aber andere frage kann man den namen und diesen comments bereich rausnehmen und den hintergrund transparent machen???
Title: Re: [Mod] Random image / Zufallsbild
Post by: rosablasiclub on September 18, 2005, 09:54:03 PM
Hey um.. not to seem incredibly impatient or anything.. but is anyone ever going to help me?! If you don't know the answer please at least tell me that so I won't be waiting for nothing..
Title: Re: [Mod] Random image / Zufallsbild
Post by: D3RB on September 18, 2005, 11:48:35 PM
sry das ich nochmal nerve :P

wenn es schon nicht transparent geht, würde es dann gehen das ich das hintergundbild dann in der php datei mit eintrage?

das komische ist ja das bei firefox das hintergrundbild angezeigt wird bei dem potm.


hoffe mir kann jetzt einer helfen
Title: Re: [Mod] Random image / Zufallsbild
Post by: TIMT on October 02, 2005, 12:48:34 PM
Hi

can this MOD cover my requirements mentioned in the following post?

http://www.4homepages.de/forum/index.php?topic=9774.msg47864#msg47864

Thanks!
Title: Re: [Mod] Random image / Zufallsbild
Post by: marc991 on October 26, 2005, 11:58:04 AM
hi an alle, hi all,

D: hier ist der Zufallsbild MOD für extra seiten ausserhalb ihrer Gallerie:
E: here the Random image MOD for extra sites outside your Gallery:

http://www.nicky.net/4images/random.txt

D: speichere den inhalt als random.php
E: save the content as random.php

D: random.php wurde mit folgenden befehl in die random_mod.php inkludiert
E: random.php was included into the random_mod.php site

D: mit
E: with
Code: [Select]
<?php
 
include("./random.php");
?>


D: viel spass
E: have fun

p.s.:
D: vielen dank an JAN der 99% der arbeit geleistet hat ;)
E: many thanks to JAN who maked 99% of this mod ;)


Hallo, habe gerade nach einer Möglichkeit gesucht ein Zufallsbild in meine Seite einzubauen. Habe als Random.php gespeichert und Hochgeladen aber irgendwie weiß ich nicht wo ich die random_mod.php hernehmen soll und wie ich die sachen dann auf meiner Page auf der Linken Seite einfüge. Bin ein neuling in sachen php aber hoffe das mir jemand weiterhelfen kann. Des weiteren möchte ich die Galerie per iframe einbinden. Das klappt auch aber ich muß dann scrollen nachdem ich ein Bild angeklickt habe. Wie mache ich dieses bündig? Danke für eure Hilfe im vorraus. Marc
Title: Re: [Mod] Random image / Zufallsbild
Post by: terk on October 26, 2005, 09:16:00 PM
Hi!

I've looked through all this topic, but didn't manage to fix my issue. It's all in this:

Quote
Security violationSecurity violation
Fatal error: Cannot instantiate non-existent class: db in /home/166413/http/foto/random.php on line 34

this is my code in random.php:

Code: [Select]
<?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''http://www.ipoding.ru/foto/');

include(
'http://www.ipoding.ru/foto/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)) ? 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 RAND() 
        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=\"0\" alt=\"$image_name\"></a><br>\n";
  echo "<b>$image_name</b><br>\n";
  echo "Comments: $image_comments<hr>\n";
}
?>


Password and user name of the db are typed in correctly....

I have no idea what to fix. Please help me!

My 4images: http://www.ipoding.ru/foto/index.php   ----- don't get shocked, it's all in Russian
Title: Re: [Mod] Random image / Zufallsbild
Post by: Maweryk on October 26, 2005, 09:22:49 PM
Try this:

Code: [Select]
// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH', '/usr/local/httpd/htdocs/.../foto/');

include(ROOT_PATH.'config.php');
include(ROOT_PATH.'includes/db_mysql.php');
include(ROOT_PATH.'includes/constants.php');

Good luck!

Markus
Title: Re: [Mod] Random image / Zufallsbild
Post by: terk on October 26, 2005, 10:57:03 PM
Try this:

Code: [Select]
// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH', '/usr/local/httpd/htdocs/.../foto/');

include(ROOT_PATH.'config.php');
include(ROOT_PATH.'includes/db_mysql.php');
include(ROOT_PATH.'includes/constants.php');

Good luck!

Markus


Now i get this:

Quote
Warning: main(): open_basedir restriction in effect. File(/usr/local/httpd/htdocs/.../foto/config.php) is not within the allowed path(s): (/home/166413) in /home/166413/http/foto/random.php on line 30

Warning: main(/usr/local/httpd/htdocs/.../foto/config.php): failed to open stream: Not owner in /home/166413/http/foto/random.php on line 30

Warning: main(): open_basedir restriction in effect. File(/usr/local/httpd/htdocs/.../foto/config.php) is not within the allowed path(s): (/home/166413) in /home/166413/http/foto/random.php on line 30

Warning: main(/usr/local/httpd/htdocs/.../foto/config.php): failed to open stream: Not owner in /home/166413/http/foto/random.php on line 30

Warning: main(): Failed opening '/usr/local/httpd/htdocs/.../foto/config.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/166413/http/foto/random.php on line 30

Warning: main(): open_basedir restriction in effect. File(/usr/local/httpd/htdocs/.../foto/includes/db_mysql.php) is not within the allowed path(s): (/home/166413) in /home/166413/http/foto/random.php on line 31

Warning: main(/usr/local/httpd/htdocs/.../foto/includes/db_mysql.php): failed to open stream: Not owner in /home/166413/http/foto/random.php on line 31

Warning: main(): open_basedir restriction in effect. File(/usr/local/httpd/htdocs/.../foto/includes/db_mysql.php) is not within the allowed path(s): (/home/166413) in /home/166413/http/foto/random.php on line 31

Warning: main(/usr/local/httpd/htdocs/.../foto/includes/db_mysql.php): failed to open stream: Not owner in /home/166413/http/foto/random.php on line 31

Warning: main(): Failed opening '/usr/local/httpd/htdocs/.../foto/includes/db_mysql.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/166413/http/foto/random.php on line 31

Warning: main(): open_basedir restriction in effect. File(/usr/local/httpd/htdocs/.../foto/includes/constants.php) is not within the allowed path(s): (/home/166413) in /home/166413/http/foto/random.php on line 32

Warning: main(/usr/local/httpd/htdocs/.../foto/includes/constants.php): failed to open stream: Not owner in /home/166413/http/foto/random.php on line 32

Warning: main(): open_basedir restriction in effect. File(/usr/local/httpd/htdocs/.../foto/includes/constants.php) is not within the allowed path(s): (/home/166413) in /home/166413/http/foto/random.php on line 32

Warning: main(/usr/local/httpd/htdocs/.../foto/includes/constants.php): failed to open stream: Not owner in /home/166413/http/foto/random.php on line 32

Warning: main(): Failed opening '/usr/local/httpd/htdocs/.../foto/includes/constants.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/166413/http/foto/random.php on line 32

Fatal error: Cannot instantiate non-existent class: db in /home/166413/http/foto/random.php on line 34

even if I remove ' :
Code: [Select]
define(ROOT_PATH, '/usr/local/httpd/htdocs/.../foto/');
still same  :(


if I change  it to
Code: [Select]
define(ROOT_PATH.'/usr/local/httpd/htdocs/.../foto/');
I get:
Quote
Warning: Wrong parameter count for define() in /home/166413/http/foto/random.php on line 28

Warning: main(ROOT_PATHconfig.php): failed to open stream: No such file or directory in /home/166413/http/foto/random.php on line 30

Warning: main(ROOT_PATHconfig.php): failed to open stream: No such file or directory in /home/166413/http/foto/random.php on line 30

Warning: main(): Failed opening 'ROOT_PATHconfig.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/166413/http/foto/random.php on line 30

Warning: main(ROOT_PATHincludes/db_mysql.php): failed to open stream: No such file or directory in /home/166413/http/foto/random.php on line 31

Warning: main(ROOT_PATHincludes/db_mysql.php): failed to open stream: No such file or directory in /home/166413/http/foto/random.php on line 31

Warning: main(): Failed opening 'ROOT_PATHincludes/db_mysql.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/166413/http/foto/random.php on line 31

Warning: main(ROOT_PATHincludes/constants.php): failed to open stream: No such file or directory in /home/166413/http/foto/random.php on line 32

Warning: main(ROOT_PATHincludes/constants.php): failed to open stream: No such file or directory in /home/166413/http/foto/random.php on line 32

Warning: main(): Failed opening 'ROOT_PATHincludes/constants.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/166413/http/foto/random.php on line 32

Fatal error: Cannot instantiate non-existent class: db in /home/166413/http/foto/random.php on line 34


 :( :( :(
Title: Re: [Mod] Random image / Zufallsbild
Post by: Maweryk on October 26, 2005, 11:11:47 PM
Sorry, the ... stand for the Rest of your Home-Path

i.e. /usr/local/httpd/htdocs/.../Foto/ or /home/166413/http/foto ;)

Cheers,

Markus

My random_more.php without comments and image name:

Code: [Select]
<?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''/usr/local/httpd/htdocs/.../4images/');
define('YOUR_URL''http://www.4imagesurl.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)) ? 0;
}

// NUMBER OF THUMBNAILS TO DISPLAY / NUMMER DER GEWÜNSCHTEN THUMBNAILS
$num_images 5;

$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 RAND() 
        LIMIT 
$num_images";
$result $site_db->query($sql);

echo 
'<table><tr>'
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'] : YOUR_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file']; 

echo 
'<td>'
echo 
"&nbsp;<a target=\"_top\" href=\"".YOUR_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a>\n"
echo 
'</td>'

echo 
'</tr></table>'


?>

Title: Re: [Mod] Random image / Zufallsbild
Post by: terk on October 27, 2005, 05:49:56 AM
Thx. I returned to the first error I recieved.

Quote
Security violationSecurity violation
Fatal error: Cannot instantiate non-existent class: db in /home/166413/http/foto/random.php on line 34

As I think, line 34 requires new Db class:
Code: [Select]
$site_db = new Db($db_host, $db_user, $db_password, $db_name);
So the problem migth be in /includes/db_mysql.php ?
Here is my code:
Code: [Select]
?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: db_mysql.php                                         *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.1                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/
if (!defined('ROOT_PATH')) {
  die("Security violation");
}

class Db {
  var $no_error = 0;
  var $connection;
  var $query_id = 0;
  var $query_count = 0;
  var $query_time = 0;
  var $query_array = array();
  var $table_fields = array();

  function Db($db_host, $db_user, $db_password = "", $db_name = "", $db_pconnect = 0) {
    $connect_handle = ($db_pconnect) ? "mysql_pconnect" : "mysql_connect";
    if (!$this->connection = $connect_handle($db_host, $db_user, $db_password)) {
      $this->error("Could not connect to the database server ($db_host, $db_user).", 1);
    }
    if ($db_name != "") {
      if (!@mysql_select_db($db_name)) {
        @mysql_close($this->connection);
        $this->error("Could not select database ($db_name).", 1);
      }
    }
    return $this->connection;
  }

  function close() {
    if ($this->connection) {
      if ($this->query_id) {
        @mysql_free_result($this->query_id);
      }
      return @mysql_close($this->connection);
    }
    else {
      return false;
    }
  }

  function query($query = "") {
    unset($this->query_id);
    if ($query != "") {
      if ((defined("PRINT_QUERIES") && PRINT_QUERIES == 1) || (defined("PRINT_STATS") && PRINT_STATS == 1)) {
        $startsqltime = explode(" ", microtime());
      }
      if (!$this->query_id = @mysql_query($query, $this->connection)) {
        $this->error("<b>Bad SQL Query</b>: ".htmlentities($query)."<br /><b>".mysql_error()."</b>");
      }
      if ((defined("PRINT_QUERIES") && PRINT_QUERIES == 1) || (defined("PRINT_STATS") && PRINT_STATS == 1)) {
        $endsqltime = explode(" ", microtime());
        $totalsqltime = round($endsqltime[0]-$startsqltime[0]+$endsqltime[1]-$startsqltime[1],3);
        $this->query_time += $totalsqltime;
        $this->query_count++;
      }
      if (defined("PRINT_QUERIES") && PRINT_QUERIES == 1) {
        $query_stats = htmlentities($query);
        $query_stats .= "<br><b>Querytime:</b> ".$totalsqltime;
        $this->query_array[] = $query_stats;
      }
      return $this->query_id;
    }
  }

  function fetch_array($query_id = -1, $assoc = 0) {
    if ($query_id != -1) {
      $this->query_id = $query_id;
    }
    if ($this->query_id) {
      return ($assoc) ? mysql_fetch_assoc($this->query_id) : mysql_fetch_array($this->query_id);
    }
  }

  function free_result($query_id = -1) {
    if ($query_id != -1) {
      $this->query_id = $query_id;
    }
    return @mysql_free_result($this->query_id);
  }

  function query_firstrow($query = "") {
    if ($query != "") {
      $this->query($query);
    }
    $result = $this->fetch_array($this->query_id);
    $this->free_result();
    return $result;
  }

  function get_numrows($query_id = -1) {
    if ($query_id != -1) {
      $this->query_id = $query_id;
    }
    return mysql_num_rows($this->query_id);
  }

  function get_insert_id() {
    return ($this->connection) ? @mysql_insert_id($this->connection) : 0;
  }
 
  function get_next_id($column = "", $table = "") {
    if (!empty($column) && !empty($table)) {
      $sql = "SELECT MAX($column) AS max_id
              FROM $table";
      $row = $this->query_firstrow($sql);
      return (($row['max_id'] + 1) > 0) ? $row['max_id'] + 1 : 1;
    }
    else {
      return NULL;
    }
  }

  function get_numfields($query_id = -1) {
    if ($query_id != -1) {
      $this->query_id = $query_id;
    }
    return @mysql_num_fields($this->query_id);
  }

  function get_fieldname($query_id = -1, $offset) {
    if ($query_id != -1) {
      $this->query_id = $query_id;
    }
    return @mysql_field_name($this->query_id, $offset);
  }

  function get_fieldtype($query_id = -1, $offset) {
    if ($query_id != -1) {
      $this->query_id = $query_id;
    }
    return @mysql_field_type($this->query_id, $offset);
  }

  function affected_rows() {
    return ($this->connection) ? @mysql_affected_rows($this->connection) : 0;
  }

  function is_empty($query = "") {
    if ($query != "") {
      $this->query($query);
    }
    return (!mysql_num_rows($this->query_id)) ? 1 : 0;
  }

  function not_empty($query = "") {
    if ($query != "") {
      $this->query($query);
    }
    return (!mysql_num_rows($this->query_id)) ? 0 : 1;
  }
 
  function get_table_fields($table) {
    if (!empty($this->table_fields[$table])) {
      return $this->table_fields[$table];
    }
    $this->table_fields[$table] = array();
    $result = $this->query("SHOW FIELDS FROM $table");
    while ($row = $this->fetch_array($result)) {
      $this->table_fields[$table][$row['Field']] = $row['Type'];
    }
    return $this->table_fields[$table];
  }

  function error($errmsg, $halt = 0) {
    if (!$this->no_error) {
      echo "<br /><font color='#FF0000'><b>DB Error</b></font>: ".$errmsg."<br />";
      if ($halt) {
        exit;
      }
    }
  }
} // end of class
?>

Maweryk, maybe you can post yours db_mysql.php?
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on October 27, 2005, 06:18:09 AM
The problem is in ROOT_PATH setting:
Quote
define('ROOT_PATH', 'http://www.ipoding.ru/foto/');

include(ROOT_PATH.'config.php');
The path must be FULL LOCAL and NOT FULL INTERNET path. if you dont know the full local path to your 4images directory, then you should ask your host administrator.
What Maweryk showed you was an example of what they have on their server. You must adopt it to your server path.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Maweryk on October 27, 2005, 10:48:57 AM
Thanks v@no. Next time I should explain it better. :oops:

Cheers,

Markus


Title: Re: [Mod] Random image / Zufallsbild
Post by: terk on October 27, 2005, 05:08:17 PM
Thanks a lot!
It was as simple as
Code: [Select]
define('ROOT_PATH', './');I just found it in lightbox.php (it was the first document I opend).
Also fixed some more things and it's working!
Thanks a lot!
Title: Re: [Mod] Random image / Zufallsbild
Post by: weissnix on November 20, 2005, 09:22:45 PM
Hallo,

hab den Mod grade erfolgreich(mit kleinen anpassungen) in mein wbblite/portal integriert.

Ein Problem hab ich noch:
Wie muss ich das ändern damit der Link in einem neuen Fenster geöffnet wird?

Code: [Select]
print("
document.write('<a href=\"".SCRIPT_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a>');
");

Title: Re: [Mod] Random image / Zufallsbild
Post by: mawenzi on November 20, 2005, 09:32:46 PM
z.B. so ...  :wink:
Code: [Select]
... <a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=\"_blank\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a>...

Title: Re: [Mod] Random image / Zufallsbild
Post by: weissnix on November 20, 2005, 09:34:06 PM
hab ich schon versucht so, dann wird das bild überhaupt nicht angezeigt...
Title: Re: [Mod] Random image / Zufallsbild
Post by: weissnix on November 21, 2005, 08:36:58 PM
Habs jetzt selbst rausgefunden...

So muss es aussehen:
Code: [Select]
<a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=\"_blank\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\" border=\"1\"></a>
Title: Re: [Mod] Random image / Zufallsbild
Post by: mawenzi on November 21, 2005, 10:41:33 PM
ja, ... genau ...  :mrgreen:
Title: Re: [Mod] Random image / Zufallsbild
Post by: WoD on December 03, 2005, 12:12:24 PM
Hallo!

Ich bekomme es auch nicht auf die Reihe, ein Zufallsbild in meinem Portal anzeigen zu lassen.
Ich fang am besten ganz von vorne mit meinen Unklarheiten an *hehe*:

Ich habe auf meinem Webspace ein 4images Verzeichnis und eins für das Forum (wbblite)

1)

Quote
// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH', './4images/');

Hier muss ich die URL zu meiner Galerie angeben, richtig?
Wäre das hier dann korrekt?:

Quote
// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH', '.http://www.abc.de/4images/');


2)

In welches Verzeichnis muss die random.php? Ich habe sie in das Hauptverzeichnis von 4images kopiert!?
Oder muss die random.php gar nicht als Datei irgendwo rein, sondern nur der Code irgendwo integriert werden in eine bestehende Datei?


3)

Wenn ich das Modul über iFrame einbinden möchte, als eine Portalbox, muss ich dann nur die URL zu der Datei angeben, also:

Quote
http://www.123.de/4images/random.php

?

...oder benötige ich dazu irgendwo diesen Code:

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

?


----------


Tut mir Leid, dass ich das nicht auf die Reihe kriege...
Hoffe trotzdem auf Hilfe ;)



Grüße
WoD
Title: Re: [Mod] Random image / Zufallsbild
Post by: weissnix on December 03, 2005, 12:37:16 PM
zu 2:

Ich hab die random.php in /4images

zu 3:

Binde es am besten über JavaScript ein.
z.B.:
Code: [Select]
<SCRIPT language='JavaScript'  src='http://www.***.de/4images/random.php'>
Hab das so in einer Portalbox bei mir stehen.

Hab Dir meine random.php angehängt, da waren noch andere Änderungen nötig, musst nur die Adresse anpassen, damit müsste es eigentlich funktionieren.
Title: Re: [Mod] Random image / Zufallsbild
Post by: WoD on December 03, 2005, 12:57:02 PM
a) Hm, wenn ich das so in die Portalbox schreibe, wird mir der Kalender(!?) angezeigt :|

b) Es ist bei der Angabe der URL in der random.php dorch richtig, dass vor dem http ein Punkt ist?

'.http://...
Title: Re: [Mod] Random image / Zufallsbild
Post by: weissnix on December 03, 2005, 01:08:47 PM
nein kein punkt

welches portal hast du denn?
Title: Re: [Mod] Random image / Zufallsbild
Post by: WoD on December 03, 2005, 02:00:40 PM
Das Portal Lite für das Woltlab Burning Board Lite
Title: Re: [Mod] Random image / Zufallsbild
Post by: WoD on December 03, 2005, 10:21:13 PM
Also: Ich verwende nun die von dir verwendete random.php, bekomme aber folgende Fehlermeldung beim direkten Aufruf der .php im Browser:

Quote
Fatal error: Cannot instantiate non-existent class: db in /usr/export/www/vhosts/funnetwork/hosting/donrenato/4images/random.php on line 35

Linie 35 entspricht:

Quote
$site_db = new Db($db_host, $db_user, $db_password, $db_name);

Muss ich da nun weitere Angaben zu meiner mySQL Datenbank machen oder wie?
Falls ja, was muss ich da ersetzen?

Grüße
WoD
Title: Re: [Mod] Random image / Zufallsbild
Post by: weissnix on December 04, 2005, 12:34:20 PM
nein, das müsste so laufen. Hab sonst keine Änderungen gemacht...
Title: Re: [Mod] Random image / Zufallsbild
Post by: WoD 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
Title: Re: [Mod] Random image / Zufallsbild
Post by: weissnix 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.
Title: Re: [Mod] Random image / Zufallsbild
Post by: WoD 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
Title: Re: [Mod] Random image / Zufallsbild
Post by: weissnix on December 04, 2005, 04:09:27 PM
OK, ändere

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

in

define('ROOT_PATH', './');
Title: Re: [Mod] Random image / Zufallsbild
Post by: WoD 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
Title: Re: [Mod] Random image / Zufallsbild
Post by: weissnix 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.
Title: Re: [Mod] Random image / Zufallsbild
Post by: WoD 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
Title: Re: [Mod] Random image / Zufallsbild
Post by: weissnix 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/');
Title: Re: [Mod] Random image / Zufallsbild
Post by: WoD on December 04, 2005, 06:10:34 PM
Super!! :D Dankeschön :) Funktioniert jetzt alles 1A *ThumbsUp* :)
Title: Re: [Mod] Random image / Zufallsbild
Post by: EggL 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
Title: Re: [Mod] Random image / Zufallsbild
Post by: weissnix on December 08, 2005, 04:28:32 PM
was meinst du mit galleriemodul?

Gib mal en Link.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Streetwise 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!

Title: Re: [Mod] Random image / Zufallsbild
Post by: Dom01 on January 03, 2006, 02:27:18 AM
Hi Leute,
ich habe eine kleines Problem mit der random.php (http://www.hairstories.de/bilder/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 (http://www.hairstories.de/bilder/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 :)
Title: Re: [Mod] Random image / Zufallsbild
Post by: CyndiMJJ 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 ???
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no 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.
Title: Re: [Mod] Random image / Zufallsbild
Post by: CyndiMJJ on January 11, 2006, 07:39:53 PM
i have the gallery on the same domain and some ip address, but what should I write? (the code)
Title: Re: [Mod] Random image / Zufallsbild
Post by: y4sh4r_x on January 14, 2006, 05:23:46 PM
why this error show?

Security violationSecurity violation
Fatal error: Cannot instantiate non-existent class: db in /home/neshoni/public_html/gallery/random.php on line 34
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on January 14, 2006, 07:08:09 PM
Probably ROOT_PATH is not correct
Title: Re: [Mod] Random image / Zufallsbild
Post by: Bodzio on January 17, 2006, 07:55:38 PM
Hi there!

great mod, but I have a problem,

I am using this on www.bonjovi.pl, right bottom.

I am also using a stat script. This script uses classes named just like the ones in 4images, for example "db".

When I add "random image" to my webiste the stat script is not working.

Is there other way to include the "random image", maybe with js or something?

I can post that script, but all its system uses this clases and I can't rename it.

What should I do?
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on January 18, 2006, 12:52:21 AM
You can modify includes/db_mysql.php and save it as includes/db_mysql_new.php
and then update this line:
Quote
include(ROOT_PATH.'includes/db_mysql_new.php');
in random.php
Title: Re: [Mod] Random image / Zufallsbild
Post by: Bodzio on January 18, 2006, 10:21:17 AM
thank you, it was simple as hell, but real hard for me to think of...

Innymi słowy, proste jak jebanie ;)
Title: Re: [Mod] Random image / Zufallsbild
Post by: Hobit on January 19, 2006, 10:08:25 PM
hallo

wer kann mir weiterhelfen.

ich habe die mod... für random und zufallsbild von hier.   ich weis nicht wie ich sie in meinem forum einbinden muss, damit ich ein zufallsbild und die 5 neusten bilder auf der startseite angezeigt kriege

ich nutze das phpkit 1.6.1 für meine webseite.

Title: Re: [Mod] Random image / Zufallsbild
Post by: Vincent on January 20, 2006, 11:44:56 AM
@hobit
hast du eine homepage?
Title: Re: [Mod] Random image / Zufallsbild
Post by: Hobit on January 20, 2006, 11:55:32 AM
Hallo Vincent

Ich habe eine Page, die für über 18 ist.

Dort sollen auch Bilder gezeigt werden, wie ich auf der Startseite mit anzeigen lassen will

Title: Re: [Mod] Random image / Zufallsbild
Post by: Hobit on January 20, 2006, 05:54:36 PM
Hallo Vincent


Hier der Link zu meiner Seite

www.real-sex-kontakt.de/member (http://www.real-sex-kontakt.de/member)

Vielleicht hilft das weiter

Title: Re: [Mod] Random image / Zufallsbild
Post by: McMark on January 21, 2006, 12:41:33 AM
Hallo ich habe meine random.php denke ich hinbekommen
zumindest kann ich sie im browser öfnen und ein bild sehen.
http://mark-foto.dyndns.org/xampp/4images/random.php
ich hätte sie aber gern unter dem letzten botten links was bzw wie muss ich das machen
in welchen dateien wird was Geändert ?
um es dort da zustellen ?
http://mark-foto.dyndns.org/xampp/4images/
ich finde leider keine anwort bei euch weil mein englisch auch nicht das beste ist.
kann mir jemand helfen?????
Title: Re: [Mod] Random image / Zufallsbild
Post by: Dom01 on January 21, 2006, 01:15:08 AM
Hi McMark,
du mußt alle Dateien ändern, wo du dein Menü eingtragen hast ändern.
Alle Dateien befinden sich im Templateverzeichnis drin.
Viel Spaß!
mfg Dom  :) [/color]
Title: Re: [Mod] Random image / Zufallsbild
Post by: McMark on January 21, 2006, 12:45:42 PM
Okay wird gemacht  :D
aber was ändere ich jetzt??? :?:
muss da das "<?php include("./random.php"); ?>
rein????
danke für dir hilfe
gruss McMark
Title: Re: [Mod] Random image / Zufallsbild
Post by: Hobit on January 21, 2006, 02:02:27 PM
@mcmark

Habe bei Dir auf der Seite geschaut, was hast Du gemacht, das die Thumbs angezeigt werden?

bei mir zeigt 4images keine thumbs an, obwohl auf Utothumbs erzeugen steht

Title: Re: [Mod] Random image / Zufallsbild
Post by: Dom01 on January 21, 2006, 05:10:30 PM
Hi McMark,
genau so muß du es machen. Dann sollte es funktionieren.
mfg Dom  :)
Title: Re: [Mod] Random image / Zufallsbild
Post by: McMark on January 21, 2006, 07:07:32 PM
Hallo Dom01
ich habe alle datein die du aufgeliste  hast geändert und in die zeille wo (random_image) stand
<?php
include("./random.php");
?>
eingetragen aber es tut sich garnichts
hast du noch eine idee
oder kann mir noch jemand helfen???
danke für jede hilfe
Gruß McMark
Title: Re: [Mod] Random image / Zufallsbild
Post by: Dom01 on January 21, 2006, 10:30:47 PM
Hi McMark,
schick mir mal den Quellcode per PM von der Home.html .
mfg Dom :)


Title: Re: [Mod] Random image / Zufallsbild
Post by: McMark on January 22, 2006, 03:27:15 PM
Hallo Dom01 schau mal bei mir rein hat geklapt  :D danke  :mrgreen:
ich habe in
categories.hml
details.html
error.html
home.html
lightbox.html
member.html
postcard_create.html
register.html
search.html
top.html
unter <?php include("4blueo1.php"); ?></p>
         <?php include("http://den genauen pfart der random angegeben  /random.php"); ?></p>
und siehe da es klappt danke
Title: Re: [Mod] Random image / Zufallsbild
Post by: Dom01 on January 22, 2006, 04:20:23 PM
Hi Mark,
 das freud mich, daß es entlich funktioniert. Aber ich frage mich wirklich, warum das nicht gleich funktioniert hat.
mfg Dom :)
Title: Re: [Mod] Random image / Zufallsbild
Post by: McMark on January 22, 2006, 04:29:31 PM
ich weis nicht warum ????
ich feu mich auch das es jetzt klappt
danke noch mal werde mich jetzt dem nächsten mod zuwenden.
gruß McMark
Title: Re: [Mod] Random image / Zufallsbild
Post by: ashleyXcore on February 11, 2006, 03:56:11 PM
Hi, I guess I'm rather late with this - I have a problem. I'm not sure if it was covered, I can't really follow the thread well with the two languages mixed together, lol.

Umm, so this random.php file works and everything: http://pink-pistol.net/gallery/random.php
But when I try to include it on my page, here: http://blog.pink-pistol.net it doesn't show up. Instead of the thumbnail it shows the alt text or something.

Oh, and can I get rid of the "comments (x)" link or no? It's not a big deal if not.

Thanks!
xo - Ashley
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on February 11, 2006, 05:42:43 PM
You random.php file is located in gallery folder so you must update
Code: [Select]
// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH', './4images/');
line in order to show it on your home page. Other words, you can not use same script to show random image on home page and in gallery folder. Move the random.php into your root directory and update the line above.

As of comments thingie, remove this line:
Code: [Select]
echo "Comments: $image_comments<br>\n";
P.S. I could not find any random image referrence on your home page...
Title: Re: [Mod] Random image / Zufallsbild
Post by: ashleyXcore on February 12, 2006, 06:57:31 AM
I'm still having problems... could you tell me exactly what to put? I've been fooling around with the path and placing the random.php file in different folders (including my main directory) but it just doesn't show up. I don't get errors, I just can't see an image - only a link.

There was no mention on my blog of a random image because I removed it - I don't want people seeing my site all screwed up, of course.

Here is my random.php file (it's in my main public_html folder)
Code: [Select]
<?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)) ? 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";
?>
(you can see that it works, here: http://pink-pistol.net/random.php)

Now, here is part of my header for my blog. I've tried the root path and just the url.
Code: [Select]
<p class="head" align="left">Random Photo</p>
<?php
 
include("http://pink-pistol.net/random.php");
?>

Please help!
Thanks <3
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on February 12, 2006, 07:37:39 AM
You can not use full internet path in the include. use
Code: [Select]
include("random.php");
Title: Re: [Mod] Random image / Zufallsbild
Post by: ashleyXcore on February 12, 2006, 07:46:06 AM
Okay... I tried that and I just get errors. The page I'm trying to include it on is in a directory called /blog - so do I need the random.php file in the /blog directory or what? Nothing is working, ugh.

I also tried including /home/pink/public_html/random.php
Title: Re: [Mod] Random image / Zufallsbild
Post by: |Rene| on February 18, 2006, 12:38:20 PM
Hallo,

ich hab ebenfalls ein Problem mit dem Random Mod. Habe die random.php in das Hauptverzeichnis meiner Webseite gelegt und unter \templates\meintemplate\index.html folgedes include eingefügt.

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

In der random.php lautet der Rootpfad:

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

Die Galerie liegt also unter www.domain.de/galerie

Wenn ich das ganze nun ausführe erhalte ich folgenden Fehler:

Warning: include(../random.php) [function.include]: failed to open stream: No such file or directory in F:\apachefriends\xampp\htdocs\Homepage\includes\template.php(101) : eval()'d code on line 44

Warning: include() [function.include]: Failed opening '../random.php' for inclusion (include_path='.;F:\apachefriends\xampp\php\pear\') in F:\apachefriends\xampp\htdocs\Homepage\includes\template.php(101) : eval()'d code on line 44

PS: Wird noch eine Datei namens random_mod.php benötigt? Hierzu finden sich im ersten Beitrag dieses Threats keine weiteren Infos. Nutze MYSQL5
Title: Re: [Mod] Random image / Zufallsbild
Post by: |Rene| on February 20, 2006, 05:04:27 PM
Liest hier niemand mehr ?  :(
Title: Re: [Mod] Random image / Zufallsbild
Post by: Roaddog on February 20, 2006, 07:40:58 PM
anscheinend nicht.....
ich bekomme es in zusammenhang mit dem wbblite nicht zum laufen. ich bekomm zwar ein bild angezeigt im portal,allerdings hängt dann press unter dem bild der kalender mit dran. wenn ich die random.php jedoch im browser aufrufe,dann kommt nur das bild an sich. vielleicht kann oder will ja mir jemand helfen.....
Title: Re: [Mod] Random image / Zufallsbild
Post by: ashleyXcore on February 23, 2006, 01:56:46 PM
Okay, this is pretty much driving me crazy...

It works by itself: http://pink-pistol.net/random.php
It KIND OF works when i include it into my blog page as well - there are no errors, but it just shows the link and no image. It's obviously not getting the right url to the image... this should be a simple problem to fix, can anyone help?

My blog is on a subdomain. So right now I'm trying to include random.php that is in my main directory, into the /blog directory. Understand?
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on February 23, 2006, 02:58:45 PM
On top of the file insert:
Code: [Select]
define("URL", "http://yourdomain.com/4images/"); //full internet path to your 4images with trailing slash!And then replace
Code: [Select]
$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";
With:
Code: [Select]
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

echo "<a href=\"".URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
Title: Re: [Mod] Random image / Zufallsbild
Post by: dj-help on February 27, 2006, 02:36:16 PM
Servus,
vielleicht habe ich etwas übersehen. Vielleicht aber auch nicht..
Folgendes: Besteht die Möglichkeit, Zufallsbilder auf dem Main und einem externem Server anzeigen zu lassen.?
Zufallsbilder werden normal angezeigt. Der Pfad ist standart. MainServer/gallerie/

Nun greife ich auch auf externe Bilder durch ein plugin zu. Leider kann mir Random Picture diese nicht anzeigen. Gibt es vielleicht ein wenn/oder Funktion?
Gruß, Phil
Title: Re: [Mod] Random image / Zufallsbild
Post by: ktwenrick on March 12, 2006, 12:34:22 AM
i love this mod and it works great..i was wondering if theres one to show the 5 most recent photos on your blog?
Title: Re: [Mod] Random image / Zufallsbild
Post by: galadrium on March 24, 2006, 08:31:43 AM
hallo zusammen

also ich habs gestern fast 3 stunden verucht, aber leider ohne erfolg.

wp muss ich die random.php datei rein kopieren? in die 4images root oder in mein portal root?

und was steht im random_mod.php

vielen dank

gala
Title: Re: [Mod] Random image / Zufallsbild
Post by: bayerns-elite on March 28, 2006, 12:21:25 AM
bei mir zeigt es leider nur die photos an zu denen auch jeder gast zutritt hat
all die photos in den kategorein wo nur angemeldete user zutritt haben werden nicht angezeigt

wie kann man das ändern ?!


aber da sind ziemlich komische fetzen in dem code

Code: [Select]
<?php
/**************************************************************************
*                                    *
*  4images - A Web Based Image Gallery Management System        *
*  ----------------------------------------------------------------  *
*                                    *
*       File&#58; random.php                      *
*    Copyright&#58; &#40;C&#41; 2002 Jan Sorgalla                *
*      Email&#58; jan@4homepages.de                  *
*       Web&#58; http&#58;//www.4homepages.de               *
*  Scriptversion&#58; 1.0 for 4images 1.6.1                *
*                                    *
*  Never released without support from&#58; Nicky &#40;http&#58;//www.nicky.net&#41;  *
*                                    *
**************************************************************************
*                                    *
*  Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-    *
*  bedingungen &#40;http&#58;//www.4homepages.de/4images/lizenz.php&#41; fur    *
*  weitere Informationen.                       *
*  ---------------------------------------------------------------   *
*  This script is NOT freeware! Please read the Copyright Notice    *
*  &#40;http&#58;//www.4homepages.de/4images/lizenz_e.php&#41; for further     *
*  information.                            *
*                                    *
*************************************************************************/

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie'
define&#40;'ROOT_PATH', './4images/'&#41;; // change this to your 4images dir.
include&#40;ROOT_PATH.'global.php'&#41;;
$new_cutoff time&#40;&#41; - 60 * 60 * 24 * $config&#91;'new_cutoff'&#93;;
$sql "SELECT IF&#40;a.image_date >= $new_cutoff,RAND&#40;&#41;+1,1&#41; as random_no, a.image_id, a.cat_id, a.image_name, a.image_active, a.image_media_file, a.image_thumb_file, a.image_comments, a.user_id
        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 random_no DESC, RAND&#40;&#41;
        LIMIT 1"
;
$row $site_db->query_firstrow&#40;$sql&#41;;
$image_extention get_file_extension&#40;$row&#91;'image_media_file'&#93;&#41;;
$image_id $row&#91;'image_id'&#93;;
$cat_id $row&#91;'cat_id'&#93;;
$image_name $row&#91;'image_name'&#93;;
$image_comments $row&#91;'image_comments'&#93;;

if &#40;empty&#40;$row&#91;'image_thumb_file'&#93;&#41;&#41; &#123;
$thumb_src ICON_PATH."/".$image_extention.".gif";
&
#125;
else &#123;
$thumb_src = &#40;is_remote&#40;$row&#91;'image_thumb_file'&#93;&#41;&#41; ? $row&#91;'image_thumb_file'&#93; &#58; ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row&#91;'image_thumb_file'&#93;;
&#125;
if &#40;!check_thumb_type&#40;$image_extention&#41;&#41; &#123;
  
$full_src ICON_PATH."/".$image_extention.".gif";
&
#125;
else &#123;
  
$full_src = &#40;is_remote&#40;$row&#91;'image_media_file'&#93;&#41;&#41; ? $row&#91;'image_media_file'&#93; &#58; ROOT_PATH.MEDIA_DIR."/".$cat_id."/".$row&#91;'image_media_file'&#93;;
&#125;
$full_src_link ROOT_PATH."details.php?image_id=$image_id";
?>

Title: Re: [Mod] Random image / Zufallsbild
Post by: Dom01 on March 28, 2006, 01:01:09 AM
Hi Leute,
ich habe es schon Lange mit dem Random-image aufgeben.Weil es nur Bilder zeig, die für alle User sichtbar sind.
Ich habe dafür ein kleines Bannerrottationsprogramm eingesetzt.
Gut, man muß alles Bilder per URL einschreiben, und wenn einer auf ein Bild klick, kommt er zur Galerie-Indes-Datei. Wo sich jeder Besucher Regestrieren kann bzw. Einlogen kann.
mfg Dom  :D
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on March 28, 2006, 04:02:18 AM
@bayerns-elite:
A link to the post where you got that code from would be more helpfull ;)
Title: Re: [Mod] Random image / Zufallsbild
Post by: bayerns-elite on March 28, 2006, 02:32:28 PM
@bayerns-elite:
A link to the post where you got that code from would be more helpfull ;)

i have already notified that post to the mods/admins

but here is it
http://www.4homepages.de/forum/index.php?topic=1020.msg17715#msg17715

on page 12
its your post
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on March 28, 2006, 03:43:50 PM
DOH! :oops:

anyways, the code is fixed now.
Title: Re: [Mod] Random image / Zufallsbild
Post by: bayerns-elite on March 28, 2006, 04:45:54 PM
thanks,
but when i open the random.php , the page is only white
no pics..... :?:
Title: Re: [Mod] Random image / Zufallsbild
Post by: bayerns-elite on April 01, 2006, 03:05:07 AM
can anybody test the code ?
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on April 02, 2006, 02:11:06 AM
http://4homepages.de/forum/index.php?topic=1020.msg12102#msg12102
Title: Re: [Mod] Random image / Zufallsbild
Post by: teedoubleyou on April 18, 2006, 09:39:33 PM
Ich habe den Mod eingebaut und er funktioniert einwandfrei. Ich benutze das Random Image als Banner für andere User und habe es folgendermassen eingebunden.

Originaldateihttp://www.nicky.net/4images/random.txt

Suche in der Random.php

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";
echo "<b>$image_name</b><br>\n";
echo "Comments: $image_comments<br>\n";
?>

-------------------------------------------------------------------------------------------------------------------
Ersetze durch

Code: [Select]
echo "<img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"><br>\n";
?>
--------------------------------------------------------------------------------------------------------------------
Code zum einbinden in eine externe HP.

Code: [Select]
<a href="http://www.your-domain.com" target="_blank"><font face="tahoma" size="2" color="#000000"><u>Your Text</u></font></a><br>
<iframe src="http://www.your-domain.com/random.php" frameborder="0" marginheight="0" marginwidth="0" height="150px" scrolling="no" width="150px"></iframe>

-------------------------------------------------------------------------------------------------------------------------

Demo hier

http://www.fotogalerie-helgoland.de/linkliste/banner.html

--------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------



I have installed this mod without problems. I use it for other Homepages banner linking to my page.

Originalfilehttp://www.nicky.net/4images/random.txt


Search in random.php

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";
echo "<b>$image_name</b><br>\n";
echo "Comments: $image_comments<br>\n";
?>

-------------------------------------------------------------------------------------------------------------------
Replace with

Code: [Select]
echo "<img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"><br>\n";
?>
--------------------------------------------------------------------------------------------------------------------
Code for external homepage

Code: [Select]
<a href="http://www.your-domain.com" target="_blank"><font face="tahoma" size="2" color="#000000"><u>Your Text</u></font></a><br>
<iframe src="http://www.your-domain.com/random.php" frameborder="0" marginheight="0" marginwidth="0" height="150px" scrolling="no" width="150px"></iframe>

-------------------------------------------------------------------------------------------------------------------------

Demo here

http://www.fotogalerie-helgoland.de/linkliste/banner.html


Done!
Title: Re: [Mod] Random image / Zufallsbild
Post by: ashleyXcore on May 06, 2006, 10:52:28 PM
On top of the file insert:
Code: [Select]
define("URL", "http://yourdomain.com/4images/"); //full internet path to your 4images with trailing slash!And then replace
Code: [Select]
$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";
With:
Code: [Select]
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

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

Just wanted to say thanks for the help. I finally checked back here and everything works great now  :)

xoxo
Title: Re: [Mod] Random image / Zufallsbild
Post by: Roaddog on May 07, 2006, 08:29:45 PM
so....ich versuche es nochmal....
habe nun erneuet versucht den mod zu integrieren in das portal meines wbblite.
mittlerweile finde ich den thread sehr unübersichtlich.
wäre es vielleicht möglich, dass jemand,der den mod schon erfolgreich eingebaut hat, mir seine lösung hier mal postet?! so richtig step by step mit allem was dazu gehört...
ich glaube das würde nicht nur mir sehr helfen....
sollte sich einer dazu aufraffen, dann danke ich im namen aller schonmal im voraus!!
Title: Re: [Mod] Random image / Zufallsbild
Post by: teedoubleyou on May 09, 2006, 03:09:46 PM
Version 1.71! Der Mod läuft perfekt. Wo hakt es denn? :roll:
Title: Re: [Mod] Random image / Zufallsbild
Post by: Roaddog on May 09, 2006, 05:07:14 PM
Version 1.71! Der Mod läuft perfekt. Wo hakt es denn? :roll:

hm,ich glaube ich habe ienfach die übersicht verloren in dem thread hier. deshalb ja die bitte, den funktionierenden code bitte nochmals übersichtlich schreiben.

**************************edit:

bekomme u.a. folgende fehlermeldung:

Warning: main(): URL file-access is disabled in the server configuration in /home/www/web2671/html/newgalerie/random.php on line 30
Title: Re: [Mod] Random image / Zufallsbild
Post by: hundi007 on May 12, 2006, 08:21:33 PM
hilfe ich bin doch zu blöde, aus irgendeinem grunde werden bei mir nicht die cat´s ausgelesen, statt des zufallbildes findet er nix und zeigt an das er das bild dort sucht: http://www.kaihundacker.de/wbb/4images/data/thumbnails//

finde den fehler nicht, wer kann mir helfen ?
Title: Re: [Mod] Random image / Zufallsbild
Post by: Blockbaster on May 30, 2006, 11:16:43 PM
Wie kann ich die Klicks noch mit einfügen? Es hat zwar schon mal einer geschrieben, es wurde aber nur indirekt beantwortet. Und wie kann ich die Farbe und Schriftgröße ändern?
Title: Re: [Mod] Random image / Zufallsbild
Post by: LeeWicKeD on June 14, 2006, 09:22:25 PM
Hi,

hab mir jetzt alle 22 Seiten durchgelesen, aber ich find meinen Fehler einfach nicht ..bin wohl echt zu blöd :twisted:

Ich hab mir die register.php in mein Homepageverzeichnis gelegt und nach

Code: [Select]
include(ROOT_PATH.'includes/constants.php');
habe ich

Code: [Select]
define('SCRIPT_URL', 'http://leewicked.le.funpic.de/hp/4images/');
eingefügt, da die galerie auf einem anderem server liegt.

Den folgenden Code

Code: [Select]
$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";

hab ich durch diesen ersetzt

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


So und auf der Indexseite meiner Homepage habe ich an der gewünschten Stelle das

Code: [Select]
<?php
 
include("./random.php");
?>

eingefügt.

die index.php und random.php habe ich dann in das selbe verzeichnis auf meinem homepageserver geladen. an der galerie selber brauch ich ja nichts verändern oder?


Trotzdem bekomme ich immer folgende Fehlermeldungen:

Code: [Select]
 
Warning: main(./4images/config.php): failed to open stream: No such file or directory in /home/craving/public_html/leewicked/random.php on line 30

Warning: main(./4images/config.php): failed to open stream: No such file or directory in /home/craving/public_html/leewicked/random.php on line 30

Warning: main(): Failed opening './4images/config.php' for inclusion (include_path='.:') in /home/craving/public_html/leewicked/random.php on line 30

Warning: main(./4images/includes/db_mysql.php): failed to open stream: No such file or directory in /home/craving/public_html/leewicked/random.php on line 31

Warning: main(./4images/includes/db_mysql.php): failed to open stream: No such file or directory in /home/craving/public_html/leewicked/random.php on line 31

Warning: main(): Failed opening './4images/includes/db_mysql.php' for inclusion (include_path='.:') in /home/craving/public_html/leewicked/random.php on line 31

Warning: main(./4images/includes/constants.php): failed to open stream: No such file or directory in /home/craving/public_html/leewicked/random.php on line 32

Warning: main(./4images/includes/constants.php): failed to open stream: No such file or directory in /home/craving/public_html/leewicked/random.php on line 32

Warning: main(): Failed opening './4images/includes/constants.php' for inclusion (include_path='.:') in /home/craving/public_html/leewicked/random.php on line 32

Fatal error: Cannot instantiate non-existent class: db in /home/craving/public_html/leewicked/random.php on line 35


Wo liegt mein Fehler?  8O

Freu mich über jede Hilfe!

Danke!
Title: Re: [Mod] Random image / Zufallsbild
Post by: Miranda on June 15, 2006, 05:31:09 PM
Hi,

ich möchte unter dem Random-Image außer dem Bild-Namen noch die Unterkategorie mit Link anzeigen lassen. Die Kategorie bekomme ich angezeigt, aber nicht die Unterkategorie. Hier ist das Ganze zu sehen: http://www.mirandus.de
Und so sieht mein Code aus:
Code: [Select]
<?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)) ? 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, b.cat_name
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
        order by image_id desc limit 1"
;
$row $site_db->query_firstrow($sql);
$image_id $row['image_id'];
$cat_id $row['cat_id'];
$cat_name $row['cat_name'];
$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\" target=\"_blank\"><img src=\"".$thumb_src."\"  alt=\"$image_name\"></a><br>~$image_name~<br>($cat_name)\n";

?>


Was muss ich da ändern ? Wäre klasse wenn mir da jemand helfen könnte :)

LG,
Miranda
Title: Re: [Mod] Random image / Zufallsbild
Post by: Miranda on June 21, 2006, 10:17:31 AM
*schieb*  :lol:

kann mir wirklich niemand sagen wo in meinem Code der Fehler ist ? Ich habe inzwischen auch feststgestellt, dass zwar auch Unterkategorien angezeigt werden, aber die falschen. Ich habe eben noch ein Bild hochgeladen und darunter steht jetzt Portraits, dabei ist es Fantasy  :roll:

Ich bin für jede Hilfe dankbar  :)

LG,
Miranda
Title: Re: [Mod] Random image / Zufallsbild
Post by: Joki on June 29, 2006, 04:19:35 PM
Hallo zusammen,

Ich bin nun auch schon den ganzen tred von vorn bis hinten durchgegangen aber nicht fündig geworden...
Und da hier ja noch nicht caos genug hersch geb ich nun auch noch einen zum besten...

Ich nutze phpkit mit 4images, habe mir eine navbox angelegt navbox.random.php
wenn ich die navbox nun in das kit mit einbinde erscheint auch ein bild aber oben links in der ecke und nicht in der navbox warum?!

nabox.random.php


Code: [Select]
<?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/');

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)) ? 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";/

?>

(http://slip4fight.de/pics/t_picfehler.jpg) (http://slip4fight.de/pics/picfehler.jpg)

Wo ist der fehler zu suchen ?! :?

MFG
Joki
Code: [Select]
Title: Re: [Mod] Random image / Zufallsbild
Post by: Amosnet on June 29, 2006, 04:21:00 PM
Ich würde sagen du musst die Navbox erstmal mit einer Seite füllen und in diese Seite dann das Script includieren.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Joki on June 29, 2006, 04:31:21 PM
Hallo Amosnet,

Also mus ich in die navbox.random.php das script includen also selber inhalt in z.b. random.php?!

Aber was soll ich da dann noch rein machen damit es zu einer seite wird die dann das bild an der richtigen stelle anzeigt?!

Leider bin ich in php noch nicht so der held *g*

Danke für jede hilfe
mfg

Joki
Title: Re: [Mod] Random image / Zufallsbild
Post by: Amosnet on June 29, 2006, 05:05:59 PM
Probier mal das Script in der navbox.random.php zu includieren, das sollte funktionieren.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Joki on June 29, 2006, 05:26:14 PM
habe ich versucht..

navbox.radom.php

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

randompic.php

das script

bekomme ich nur
Warning: main(randompicphp): failed to open stream: No such file or directory in /var/www/html/web81/html/slipHP/navigation/navbox.random.php on line 2

Warning: main(): Failed opening 'randompicphp' for inclusion (include_path='.') in /var/www/html/web81/html/slipHP/navigation/navbox.random.php on line 2

Title: Re: [Mod] Random image / Zufallsbild
Post by: Amosnet on June 29, 2006, 05:37:22 PM
wo liegt denn dein Ramdom.php??

Title: Re: [Mod] Random image / Zufallsbild
Post by: Joki on June 29, 2006, 06:30:58 PM
im selben ordner also /navigation/
Title: Re: [Mod] Random image / Zufallsbild
Post by: Joki on July 01, 2006, 08:16:54 PM
OK bin schonmal ein stück weitergekommen...

durch die erweiterung/änderung

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

$boxlinks[]="<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";/

?>


ich habe das echo gegen $boxlinks[]= ersetzt...

Nun habe ich das Problem das zwar das bild angezwigt wird nur wenn einer in der shortbox was schreibt und abschickt bekommt er diese fehlermeldung:
Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/web81/html/slipHP/navigation/navbox.random.php:3) in /var/www/html/web81/html/slipHP/navigation/navbox.laberecke.php on line 77

Kann mir einer sagen was das bedeutet also wo ich den fehler nun suchen mus?!

MFG
Joki
Title: Re: [Mod] Random image / Zufallsbild
Post by: Joki on July 14, 2006, 01:04:35 AM
Wei keiner wie man den fehler entgegenwirken kann?!  :(
Title: Re: [Mod] Random image / Zufallsbild
Post by: Miranda on July 14, 2006, 06:51:54 PM
Hallo,

bei mir laüft das Script einwandfrei. Jetzt möchte ich aber statt des Thumbnails das "große" Bild als Random-Image anzeigen lassen. Was muss ich im Script dafür ändern ?

Danke schonmal :)

LG,
Miranda
Title: Re: [Mod] Random image / Zufallsbild
Post by: ahmad6 on August 08, 2006, 03:28:57 PM
hi  i want random image in 6 image but show 1 image please help me
Title: Re: [Mod] Random image / Zufallsbild
Post by: Unipandra on August 31, 2006, 04:58:15 PM
Hallo,

ich habe mir jetzt den ganzen Thread von vorne bis hinten durchgelesen und alles mögliche ausprobiert, aber ich krieg das einfach nicht hin. Ich möchte die Zufallsbilder meiner 4images-Galerie in meinem phpkit anzeigen lassen. Kann mir bitte nochmal jemand erklären, was ich genau mit dem script machen muss, wohin ich es installieren muss, was ich angeben muss usw. ? In englisch bin ich nicht besonders gut.

LG Unipandra
Title: Re: [Mod] Random image / Zufallsbild
Post by: Unipandra on September 02, 2006, 04:09:43 PM
ok, nach dem 5. mal durchlesen dieses Threads habe ich es hingekriegt. Aber weiß jemand, wie ich die Zufallsbilder in die Navbox vom phpkit kriege?
Title: Re: [Mod] Random image / Zufallsbild
Post by: Daniel on September 07, 2006, 02:50:00 PM
Könnte man unter dem Zufallsbild auh den User-Namen einblenden?
Is it possible to show the User-Name under the Random-Pic?

Dank und Gruß
Daniel
Title: Re: [Mod] Random image / Zufallsbild
Post by: vBFreak on September 26, 2006, 11:16:50 PM
Hey, works fine, thanks :)

How can I get the username of the user who posted the image within that query? I'm using this to show random pics from my member gallery, but they sometimes don't use their names in the image titles, so it would be good to have a username to assign it to ;)

(Edit: Huch, jetzt fang ich schon an in deutschen Foren englisch zu schreiben, ich geb mich natürlich auch mit ner deutschen Antwort zufrieden :D)
Title: Re: [Mod] Random image / Zufallsbild
Post by: Bruce Lee on October 16, 2006, 04:14:48 PM
Hallo, ich habe mal ne Frage zu dem Zufallsbild Mod.

Das Einrichten ist ja ziemlich einfach wenn man sich vorher alles genau durchliest.
Jedoch habe ich noch folgende Probleme bzw. Fragen.

Ich möchte das Zufallsbild nur auf einer externen Seite anzeigen lassen ohne das
darauf geklickt werden kann, da ich 4images in einem IFrame laufen habe und das
sonst bei mir nur Chaos gibt. Was muss also in der random.php gelöscht werden
ohne das ich sie zerstöre ?

Bei mir kann jedermann alle Vorschaubilder (Thumbs) sehen. Jedoch muß, wer das
vergrößerte Bild sehen will, eingeloggt also Registriertes Mitglied sein.
Bei dieser Einstellung kann ich aber kein Zufallsbild angezeigt bekommen.

Warum nicht ? Das Zufallsbild soll doch nur das Thumbnail Bild sein, welches doch
sowieso jeder sehen kann.

Gibt es hierfür eine Lösung ?

Vielen Dank schon mal im Vorraus



Title: Re: [Mod] Random image / Zufallsbild
Post by: Acidgod on October 16, 2006, 04:20:20 PM
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";
Das solltest Du ändern...
Title: Re: [Mod] Random image / Zufallsbild
Post by: Bruce Lee on October 16, 2006, 05:26:26 PM
So, habe die betreffende Stelle geändert und es funzt auch prima.

Jedoch ist da immer noch das Problem mit dem Registrierten Mitglied.
Kann man das nicht irgendwie umgehen, da ja nur die Thumbs angesprochen
werden sollen ohne Verlinkung auf das vollständige Bild.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Acidgod on October 16, 2006, 05:48:57 PM
Code: [Select]
AND b.auth_viewimage=".AUTH_ALL."
An beide Stellen löschen und dann sollte das funzen... Hoffe ich... (o:
Title: Re: [Mod] Random image / Zufallsbild
Post by: Bruce Lee on October 16, 2006, 08:30:18 PM
Hat leider immer noch nicht geklappt. Funktioniert wohl nur wenn ich eine Kategorie für Alle freigebe.
Bei mir soll sich halt jeder vorher registrieren. Das Zufallsbild hatte ich für meine Startseite gedacht.
Sollte es da keine Möglichkeit geben dieses so zu ändern das man ein Zufalls Thumb sehen kann,
habe ich eben Pech gehabt. Sollte doch noch jemand ne Idee haben würde ich mich freuen.  :D
Title: Re: [Mod] Random image / Zufallsbild
Post by: e10ff on October 23, 2006, 03:56:41 PM
Hi all, script Random Pic. is very useful for my site, I have integration vbulletin forum + 4images, but when i try 2 include file with your code, i get many error like "error on lin 217". Is it possible to make Rand Pic Mod without use 4images functions? THNKS
Title: Re: [Mod] Random image / Zufallsbild
Post by: Masilius on October 28, 2006, 08:08:16 PM
Hallo,

Das script an sich funtkioniert, als es zeigt bilder an, allerdings nimmt es nur bilder aus 2 bestimmten kategorieen.

Ist das normal, wie kann ich das ändern ?
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on November 18, 2006, 09:58:25 PM
Hallo,

Das script an sich funtkioniert, als es zeigt bilder an, allerdings nimmt es nur bilder aus 2 bestimmten kategorieen.

Ist das normal, wie kann ich das ändern ?

bitte als erstes, deine site anzeigen wo die bilder dargestellt werden.. und dann die galerie.. wäre ja vom vorteil. weil so, kann ich nur raten (vielleicht andere kategorien für die "öffentlichkeit" nicht sichtbar)..
Title: Re: [Mod] Random image / Zufallsbild
Post by: Masilius on November 19, 2006, 07:54:51 PM
ja wohl genau das wars *g* Vielen dank das hat mir sehr weitergeholfen :)


-
Masilius
Title: Re: [Mod] Random image / Zufallsbild
Post by: koikonut on November 27, 2006, 11:54:54 PM
Hallo!

Bei mir hat das Script immer einwandfrei funktioniert. Aber plötzlich wird einfach kein Bild mehr angezeigt bzw. nichts mehr von der Datenbank geholt scheint mir:
www.konradin.net holt sich die /galerie/random.php die wie folt aussieht (exkl. Copyright):

Code: [Select]
<?php

// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH''galerie/');

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)) ? 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 
"<div style=\"float: left; background-color:#d3ca91;padding:1px\"><a href=\"".ROOT_PATH."img".$image_id.".htm\"><img src=\"".$thumb_src."\" border=\"0\" style=\"border: 6px solid white;\" alt=\"".$image_name."\" /></a></div><br style=\"clear:both;\"/>\n<br />\n";
echo 
"<b>".$image_name."</b><br />\n";
echo 
"Kommentare: ".$image_comments."<br />\n";
?>

Bitte helft mir - weiß keinen Lösungsansatz - vor allem weil ich nichts verändert habe und es einfach nicht mehr funktioniert. Als einzige Veränderung fällt mir der Einbau von Google Analytics ein aber weiß nicht ob der Fehler schon vorher war und kann ja eigentlich nichts zu bedeuten haben.

Vielen vielen Dank!

Gruß K,
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on November 28, 2006, 07:28:59 PM
da steht komischerweise >
Quote
<a href="galerie/img.htm"><img src="galerie/data/thumbnails//" border="0" style="border: 6px solid white;" alt="" /></a>

Code: [Select]
        AND b.auth_viewcat=".AUTH_ALL."
        AND b.auth_viewimage=".AUTH_ALL."

Registriere dich, um dieses Bild groß; anzuschauen!

wird vielleicht das der grund sein?
Title: Re: [Mod] Random image / Zufallsbild
Post by: koikonut on November 28, 2006, 10:38:22 PM
Du meinst, dass die Bilder gesperrt sind? Ich sehe das Zufallsbild auch nicht im eingeloggten Zustand und außerdem sind nur die Großansichten, nicht aber die Thumbs gesperrt. Hmm - was könnte noch die Möglichkeit sein? Kann auch noch andere Codes posten wenns hilft :-)

Bitte helfen! Danke!  :-)

Gruß K
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on November 28, 2006, 10:49:34 PM
egal ob eingelogt oder ausgelogt, thumbnail oder nicht..

du verbietest das man auf die thumbnails klickt.. und damit zeigt random nichts.

Title: Re: [Mod] Random image / Zufallsbild
Post by: koikonut on November 28, 2006, 10:59:00 PM
Ich weiß allerdings nicht, woher du diesen Satz mit dem "Registriere dich, um ..." her hast - der kommt an diese Stelle der Galerie gar nicht vor - zumindest nicht bei mir?! Der sollte nur kommen, wenn ein Bild angezeigt wird, zu dem keine Berechtigung in der großen Version besteht - ich kann ihn auch nicht im Quellcode sehen..

Was müsste ich also tun, wenn du recht hast?

Vielen Dank nochmal!
Gruß
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on November 29, 2006, 07:18:02 PM
wenn das grosse bild nicht angezeigt werden darf, wird auch der thumbnail nicht in der random angezeigt.

probiere dies aus beiden queries zu löschen
Code: [Select]
AND b.auth_viewimage=".AUTH_ALL."
Title: Re: [Mod] Random image / Zufallsbild
Post by: koikonut on November 29, 2006, 08:32:39 PM
Vielen Dank! Es funktioniert tatsächlich :-) Freue mich, wie gut die Hilfe hier funktioniert :-)

Gruß
Title: Re: [Mod] Random image / Zufallsbild
Post by: ma3foos on December 15, 2006, 06:33:28 AM
Please can any one upload this file again "random.txt"

becuase I'm in kuwait and here they blocked "www.Nicky.com"

So Please help, I need this command
Title: Re: [Mod] Random image / Zufallsbild
Post by: Jan on December 15, 2006, 12:53:16 PM
I've attached the random.txt to the first post (http://www.4homepages.de/forum/index.php?topic=1020.msg4324#msg4324).
Title: Re: [Mod] Random image / Zufallsbild
Post by: ma3foos on December 15, 2006, 06:51:20 PM
Thanks man
Title: Re: [Mod] Random image / Zufallsbild
Post by: Ricsca on January 03, 2007, 07:09:55 PM
How it is possible to make to visualize alone photograph of a category? 

Thanks
Title: Re: [Mod] Random image / Zufallsbild
Post by: Acidgod on January 03, 2007, 09:00:23 PM
AND a.cat_id = b.cat_id replace this with the cat_id.... (2 times!!!)
Title: Re: [Mod] Random image / Zufallsbild
Post by: Ricsca on January 03, 2007, 09:32:40 PM
I do not understand... my category is the 9 how I should put? 


$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."
Title: Re: [Mod] Random image / Zufallsbild
Post by: Acidgod on January 04, 2007, 01:24:25 PM
$sql = "SELECT COUNT(*) as total_images
        FROM ".IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
        WHERE a.image_active=1
        AND a.cat_id = 9
        AND b.auth_viewcat=".AUTH_ALL."
        AND b.auth_viewimage=".AUTH_ALL."

Try this....
But don't forget to change the another query...
Title: Re: [Mod] Random image / Zufallsbild
Post by: Ricsca on January 05, 2007, 01:45:47 AM
It does not work... 
Title: Re: [Mod] Random image / Zufallsbild
Post by: Acidgod on January 05, 2007, 09:52:50 AM
########################################
$sql = "SELECT COUNT(*) as total_images
        FROM ".IMAGES_TABLE." a, ".CATEGORIES_TABLE." b
        WHERE a.image_active=1
        AND a.cat_id = '80'
        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 = '80'
        AND b.auth_viewcat=".AUTH_ALL."
        AND b.auth_viewimage=".AUTH_ALL."
        LIMIT $number, 1";
$row = $site_db->query_firstrow($sql);
########################################



Replace the 80 with your cat_id... (o:
so it works on my site:
http://www.picsforfree.de/random.php
Title: Re: [Mod] Random image / Zufallsbild
Post by: Ricsca on January 06, 2007, 03:06:12 AM
I found the problem...
It introduces the id of the specific category and not of the category in general...

How it is possible to make to see more categories? 

Thanks
Title: Re: [Mod] Random image / Zufallsbild
Post by: CeJay on January 12, 2007, 12:58:16 AM
I am using the random_more_pics mod.

What I would like to show along with the name and comments is the rating of the image.
Is this possible? If so what do I need to change?

Sorry if this was already answered in a different language, all i know is english.
Title: Re: [Mod] Random image / Zufallsbild
Post by: CeJay on January 12, 2007, 08:33:16 AM
Not sure if I gave enough info on last post.
Do I need to do something like what was posted in this post on the random_more_pics.php like so?

$image_hits = $row['image_hits'];
$image_rating = $row['image_rating'];
and
echo "Hits: $image_hits<br>\n";
echo "Bewertung: $image_rating<br>\n";

I tried to figure this out before I asked.
If adding ratings is not possible is it possible for hits?
Title: Re: [Mod] Random image / Zufallsbild
Post by: mawenzi on January 12, 2007, 02:07:50 PM
@ CeJay
... try this ...
Code: [Select]
echo "Hits: ".$image_hits."<br>\n";
echo "Bewertung: ".$image_rating."<br>\n";
Title: Re: [Mod] Random image / Zufallsbild
Post by: CeJay on January 13, 2007, 12:55:00 AM
@ CeJay
... try this ...
Code: [Select]
echo "Hits: ".$image_hits."<br>\n";
echo "Bewertung: ".$image_rating."<br>\n";

Ok I added that. Here is what I have on the php:
Code: [Select]
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'];
  $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 "<table border='0' width='213' Align=left>\n";
  echo "<TR>\n";
  echo "<TD><a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a></TD>\n";
  echo "</TR>\n";
  echo "<TR>\n";
  echo "<TD><b>$image_name</b></TD>\n";
  echo "</TR>\n";
  echo "<TR>\n";
  echo "<TD>Comments: $image_comments</TD>\n";
  echo "</TR>\n";
  echo "<TR>\n";
  echo "Hits: ".$image_hits."<br>\n";
  echo "</TR>\n";
  echo "<TR>\n";
  echo "Rating: ".$image_rating."<br>\n";
  echo "</TR>\n";
  echo "</table>\n";

The tables are set to have the rows horizontal so that is why you see that.

I do have the listing for the ratings and hits, however nothing (the count) shows up next to them.
I did double check the images that loaded to see if there was at least hits and there was.
Title: Re: [Mod] Random image / Zufallsbild
Post by: CeJay on January 13, 2007, 01:12:55 AM
Nevermind I got it, something I should have seen from the start   :oops:

I had
Code: [Select]
$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

and needed
Code: [Select]
$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_hits, a.image_rating
        FROM ".IMAGES_TABLE." a, ".CATEGORIES_TABLE." b


@ mawenzi
Thanks for your help, I appreciate it  :!:
Title: Re: [Mod] Random image / Zufallsbild
Post by: wallpapers on January 13, 2007, 11:04:06 PM
Ok this is diffecult to explain for me but i give it a trie.
First it is a good mod :D

My question:
My database have more 4 images tables
So the table database looks like this:
Code: [Select]
  test_4images_categories
  test_4images_comments
  test_4images_groupaccess
  test_4images_groupmatch
  test_4images_groups
  test_4images_images
  test_4images_images_temp
  test_4images_lightboxes
  test_4images_postcards
  test_4images_sessions
  test_4images_sessionvars
  test_4images_settings
  test_4images_users
  test_4images_wordlist
  test_4images_wordmatch
  test2_4images_categories
  test2_4images_comments
  test2_4images_groupaccess
  test2_4images_groupmatch
  test2_4images_groups
  test2_4images_images
  test2_4images_images_temp
  test2_4images_lightboxes
  test2_4images_postcards
  test2_4images_sessions
  test2_4images_sessionvars
  test2_4images_settings
  test2_4images_users
  test2_4images_wordlist
  test2_4images_wordmatch

How can i do so that the random.php randomise all off the images from the different 4images databases.

I hope you will understand my english :roll:
Title: Re: [Mod] Random image / Zufallsbild
Post by: yukino_girl on January 27, 2007, 01:54:32 AM
how do i get this to work as a module on my vbadvanced homepage? can anyone help me with that?
Title: Re: [Mod] Random image / Zufallsbild
Post by: CeJay on January 27, 2007, 08:51:28 AM
how do i get this to work as a module on my vbadvanced homepage? can anyone help me with that?
I don't know vbadvanced, but if you know where you want the image the put in a tag on the home page
Code: [Select]
<?php
 
include("./random.php");
?>
or create it in iFrame and call the random image in there.
Title: Re: [Mod] Random image / Zufallsbild
Post by: RoadDogg on February 05, 2007, 12:22:56 AM
Ich habe nun schon einiges gelesen und gestet, allerdings wird bei mir das thumbnail nicht angezeigt. Statt der kompletten Bildadresse kommt nur das hier:

http://duesipixel.de/random_full.php

Code: [Select]
<a href="http://duesipixel.de/details.php?image_id=1240"><img src="http://duesipixel.de/data/thumbnails/36/" border="0" alt="Jahresabschluss05 in Speyer"></a><br>
$row['image_thumb_file'] wird nicht umgewandelt?

Hier die random.php

Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: random_full.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
define('ROOT_PATH''/home/w11854/web/public_html/newgalerie/');

include(
ROOT_PATH.'config.php');
include(
ROOT_PATH.'includes/db_mysql.php');
include(
ROOT_PATH.'includes/constants.php');

define('SCRIPT_URL''http://duesipixel.de/');

$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)) ? 0;
}

$sql "SELECT COUNT(*) as total_images
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b 
        WHERE a.image_active=1       
        AND a.cat_id IN (35, 36, 58, 59, 61, 66)
        AND b.cat_id IN (35, 36, 58, 59, 61, 66)
        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_media_file, a.image_comments, b.cat_name  
        FROM "
.IMAGES_TABLE." a, ".CATEGORIES_TABLE." b 
        WHERE a.image_active=1 
        AND a.cat_id IN (35, 36, 58, 59, 61, 66)
        AND b.cat_id IN (35, 36, 58, 59, 61, 66)
        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'];       
$cat_name $row['cat_name'];
$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 
"<a href=\"".SCRIPT_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$cat_name\"></a><br>\n";
?>

Weiß jemand woran das liegt??
Title: Re: [Mod] Random image / Zufallsbild
Post by: RoadDogg on February 08, 2007, 11:22:52 AM
For all who don´t see an image and source code looks like
<img src="http://.../data/thumbnails/36/" border="0" ...>

this works
http://www.4homepages.de/forum/index.php?topic=1020.msg12102#msg12102
Title: Re: [Mod] Random image / Zufallsbild
Post by: FunnyUser on February 13, 2007, 12:53:30 PM
Quote
Code: [Select]
$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=2
AND b.auth_viewcat=".AUTH_ALL."
AND b.auth_viewimage=".AUTH_ALL."<br>
LIMIT $number, 1";

Also das klappt bei mir wunderbar!
Ich möchte es so: meine Kategorie "Dogs" hat die "ID=1", hat aber mehrere Unterkategorien. Wenn ich nun in meiner "random.php" "AND a.cat_id=1" eingebe, werden wirklich NUR die Dateien aus der direkten Hauptkategorie ausgelesen, aber nicht die aus den Subkategorien.

Wie kann ich es ändern, dass auch die zugehörigen Unterkategorien von "ID=1" ausgelesen werden?


Danke
Title: Re: [Mod] Random image / Zufallsbild
Post by: mawenzi on February 13, 2007, 03:46:12 PM
... verwende z.B. ...
Code: [Select]
AND a.cat_id IN (1,2,3,4,5,6,7,8,9)
... in der Klammer die Kategorie_IDs aufzählen, die gezeigt werden sollen ...  :wink:
Title: Re: [Mod] Random image / Zufallsbild
Post by: alphavto on February 21, 2007, 05:25:29 PM
Mein Provider stellt zum 01. März 2007 auf PHP 5.2.0 um. Die random.php funktioniert bis dato unter PHP 5.1.4.
Ich kann nun testen ob alles mit der neuen PHP-Version klappt.
Einzig das Zufallsbild wird jetzt nicht mehr angezeigt, auch nicht der Bildname und die Comments.
Hab extra nochmal die Datei vom ersten Post genommen, ist das selbe.
Hat schon wer die random.php auf PHP 5.2.0 laufen?

PHP-Info: PHP-Info Version 5.2.0 (http://www.alphaville.nu/php_info.php) => leere Ausgabe
PHP-Info: PHP-Info Version 5.1.4 (http://www.block-a.de/php_info.php) => korrekte Ausgabe
Title: Re: [Mod] Random image / Zufallsbild
Post by: alphavto on March 02, 2007, 02:29:17 PM
Nun ist der 01. März vorbei die neue Version PHP 5.2.0 läuft und auch das Vorschaubild funktioniert. Vielleicht gingen nicht alle Funktionen während des Testbetriebes. Naja auch Wurst, MOD funktioniert auch mit PHP 5.2.0
Title: Re: [Mod] Random image / Zufallsbild
Post by: CeJay on March 03, 2007, 07:23:33 AM
Nun ist der 01. März vorbei die neue Version PHP 5.2.0 läuft und auch das Vorschaubild funktioniert. Vielleicht gingen nicht alle Funktionen während des Testbetriebes. Naja auch Wurst, MOD funktioniert auch mit PHP 5.2.0

Dank für das Informieren wir.
Traurig für schlechte Sprache, benutztes google translater zum zu reagieren
Title: Re: [Mod] Random image / Zufallsbild
Post by: Gibsy on March 16, 2007, 10:57:00 AM
Hallo,

ich konnte es nur als iframe in meinem portal_body.tpl einfügen, da ich es anders nicht einfügen konnte.
Code: den ich in mein portal_body.tpl eingefügt habe und auch funktioniert bis auf den weißen hintergrund (siehe Bild unten)
Quote
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<th height="28"><b>::  {actualstats55} ::</b></th>
</tr>
<tr>
<td class="row1" align="center"><iframe name="I1" scrolling="no" valign="middle" border="0" frameborder="0" src="http://www.gibsy.com/dim/random.php" width="100%" height="100%">Ihr Browser unterstützt Inlineframes nicht oder zeigt sie in der derzeitigen Konfiguration nicht an.</iframe></center>
</td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" class="tbl"><tr><td class="tbll"><img src="images/spacer.gif" alt="" width="8" height="4" /></td><td class="tblbot"><img src="images/spacer.gif" alt="" width="8" height="4" /></td><td class="tblr"><img src="images/spacer.gif" alt="" width="8" height="4" /></td></tr></table>
<br>
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">


kann man es anders auch einfügen, außer als iframe :?: ich bekomme es nicht hin :cry:

wenn es anders auch geht, welchen link oder code muß ich in den unteren code da wo XXXX steht einfügen :!:
Quote
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<th height="28"><b>::  {actualstats55} ::</b></th>
</tr>
<tr>
<td class="row1" align="center"><XXXXXXXXXXX></center>
</td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" class="tbl"><tr><td class="tbll"><img src="images/spacer.gif" alt="" width="8" height="4" /></td><td class="tblbot"><img src="images/spacer.gif" alt="" width="8" height="4" /></td><td class="tblr"><img src="images/spacer.gif" alt="" width="8" height="4" /></td></tr></table>
<br>
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">

als iframe funktioniert es schon wie unten abgebildet, aber wie bekomme ich den weißen hintergrund in meiner Seitenfarbe ---> #E1E9F2

(http://www.gibsy.com/dim/gibsy_files/Bild2.gif)

bin für jede Hilfe dankbar, by Gibsy
Title: Re: [Mod] Random image / Zufallsbild
Post by: Gibsy on March 17, 2007, 06:37:20 AM
Kann mir da keiner einen rat geben :oops:
Title: Re: [Mod] Random image / Zufallsbild
Post by: CeJay on March 17, 2007, 08:15:01 AM
könnte es in der <td class= " row1 " sein?

kann nicht finden, welche Ursache das  :oops:
Title: Re: [Mod] Random image / Zufallsbild
Post by: Gibsy on March 17, 2007, 01:49:20 PM
ne, an dem liegt es bestimmt nicht:
alle boxen stehen auf row1
in der css datei steht auch:     row1  --> background-color: #E1E9F2

ich glaube bei random.php muß man irgendwo Hintergrund farbe angeben können, es ist ja automatisch weiß.

ich brauche hilfe wie ich das weiße wegbekomme :oops:

hat noch jemand einen rat :cry:
Title: Re: [Mod] Random image / Zufallsbild
Post by: KurtW on March 17, 2007, 03:16:17 PM
Hallo,

ich würde das Bild in der random.php in eine tabelle mit gewünschter Hintergrundfarbe verfrachten.  :wink:

z.B.

Code: [Select]
echo "<table border=\"0\" width=\"100%\" height=\"150\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#E1E9F2\">\n<tr>\n<td width=\"100%\" valign=\"middle\" align=\"center\">";
echo "<a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
echo "</td>\n</tr>\n</table>\n</center></div>\n";


Gruß
Kurt
Title: Re: [Mod] Random image / Zufallsbild
Post by: Gibsy on March 17, 2007, 08:14:48 PM
Hallo Kurt danke für Dein bemühen.

ich habe es als iframe in meinem portal_body.tpl eingebunden.
kann ich das auch anders einfügen außer iframe :?:

Quote
wenn es anders auch geht, welchen link oder code muß ich in den unteren code da wo XXXX steht einfügen

<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
<tr>
<th height="28"><b>::  {actualstats55} ::</b></th>
</tr>
<tr>
<td class="row1" align="center"><XXXXXXXXXXX></center>
</td>
</tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" class="tbl"><tr><td class="tbll"><img src="images/spacer.gif" alt="" width="8" height="4" /></td><td class="tblbot"><img src="images/spacer.gif" alt="" width="8" height="4" /></td><td class="tblr"><img src="images/spacer.gif" alt="" width="8" height="4" /></td></tr></table>
<br>
<table width="100%" cellpadding="2" cellspacing="1" border="0" class="forumline">
es klappt einfach nicht :cry:
nun sieht es so aus:
(http://www.gibsy.com/dim/gibsy_files/Bild3.gif)

so sollte es aussehen:
(http://www.gibsy.com/dim/gibsy_files/Bild4.gif)


vielen dank im voraus, by Gibsy
Title: Re: [Mod] Random image / Zufallsbild
Post by: KurtW on March 17, 2007, 08:31:26 PM
Hallo,

ja geht normalerweise auch mit:
Code: [Select]
<?php
include 'random.php';
?>

oder du änderst mal den oben genannten code in der random.php duch folgenden (dann klappts auch):

Code: [Select]
echo "<html>\n<head>\n</head>\n<body topmargin=\"0\" leftmargin=\"0\">";
echo "<table border=\"0\" width=\"100%\" height=\"150\" cellspacing=\"0\" cellpadding=\"0\" bgcolor=\"#E1E9F2\">\n<tr>\n<td width=\"100%\" valign=\"middle\" align=\"center\">";
echo "<a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
echo "</td>\n</tr>\n</table>\n</center></div>\n";
echo "</body>\n</html>\n";


Gruß
Kurt
Title: Re: [Mod] Random image / Zufallsbild
Post by: Gibsy on March 17, 2007, 09:19:18 PM
Vielen Herzlichen Dank Kurt für Deine Zeite und Mühe die Du aufbringen mußtest :oops:

Jetzt ist es genau so wie ich es haben wollte :D klappt einwandfrei *juuhuu*



Danke nochmals Kurt schöne Grüße by Gibsy
Title: Re: [Mod] Random image / Zufallsbild
Post by: Gibsy on March 17, 2007, 09:31:40 PM
Etwas kitzekleines wäre noch :oops:

Wenn ich auf den thumb klicke geht es in der kleinen box auf 8O

Besser wäre es wenn es auf der gleichen Seite aufgehen würde :oops:


Schöne Grüße by Gibsy

----------------------
edit:

so ging es:

das
<a href=\"".ROOT_PATH."details.php?image_id=$image_id\">

mit dem ersetzt
<a href=\"".ROOT_PATH."details.php?image_id=$image_id\" target=\"_parent\">


Toll jetzt ist es super

Schöne Grüße by Gibsy
Title: Re: [Mod] Random image / Zufallsbild
Post by: yogi on May 06, 2007, 10:51:11 AM
Hallo,seit kurzem benutze ich auch 4images und möchte die Zufallsbilder ( oder auch Vorschaubild ) in einer Box meines Portals anzeigen. Ich habe das ganze Forum hier schon durchgearbeitet und kriegs einfach nicht hin.Ob ich jetzt die ganze php Datei in die Box schreibe oder Include ich hab immer den selben fehler und zwar macht es mir alle meine anderen boxen ( Dunkel ).Was mach ich da verkehrt?Kann mir jemand helfen?
www.michel-juergen.de

Viele Grüße
Jürgen
Title: Re: [Mod] Random image / Zufallsbild
Post by: yogi on May 06, 2007, 12:33:43 PM
Hier mal so Beispiel.http://michel-juergen.de/shot/4im1.gif (http://michel-juergen.de/shot/4im1.gif)
undmichel-juergen.de/shot/4im2.gif (http://michel-juergen.de/shot/4im2.gif)

Im ersten Bild seht ihr wie das Script mir alles dunkel macht,
im zweiten seht ihr wie es normal aussieht.

Viele Grüße
Jürgen
Title: Re: [Mod] Random image / Zufallsbild
Post by: KurtW on May 06, 2007, 01:12:33 PM
Hallo yogi,

wie wolltest du das random einbauen. So wie im 1 Posting dieses Threads mit include?
Falls ja, bring mal die random.php zum Laufen, also richtige Pfade eintagen.


Gruß
Kurt
PS. Dann meld dich wieder. Möchte es mir mal mit Einau ansehen. :wink:
Title: Re: [Mod] Random image / Zufallsbild
Post by: yogi on May 06, 2007, 02:10:37 PM
habs mit include probiert,dann sieht es so aus wie jetzt auch.
In dieser Dastellung die du gerade siehst ist die ganze random.php ( das Script ) in die box eingebaut.
Was für Pfade muß ich denn noch ändern.
Oder vielleicht hab ich die Random.php verkehrt auf dem webspace abgelegt?
Wo muß sie genau hin damit ich sie in einer box includen kann.
Gruß
Yogi
Title: Re: [Mod] Random image / Zufallsbild
Post by: KurtW on May 06, 2007, 02:14:49 PM
Hallo,

http://michel-juergen.de/4images/random.php (http://michel-juergen.de/4images/random.php)
Oder musstest du die Pfade ändern, damit die random images in deiner Page angezeigt werden?

Kurt
Title: Re: [Mod] Random image / Zufallsbild
Post by: yogi on May 06, 2007, 02:40:02 PM
Die Pfade müssen ja stimmen,sonst würde es ja nicht in der Box angezeigt ( Screen Shot 1 ).
Nur drückt das Script ( egal so oder mit Include ) mir alles andere weg ( Screen Shot 2 )
Das Script ist im Original Zustand.
Bin ehrlich Ratlos,den es ist ja nicht das erste Script das ich einbaue.

Gruß
Yogi
Title: Re: [Mod] Random image / Zufallsbild
Post by: KurtW on May 06, 2007, 03:36:31 PM
Hallo

tja, hab ich ganz übersehen, das randombild ja schon angezeigt wurde.
Als stimmen die Pfade.

Vielleicht wurde include nicht mit
Code: [Select]
?>geschlossen ?
Weiß nicht, obs dann möglich ist diese aufzurufen.

Wenns nicht anders klappt, würde ich die random in einen iframe laden.


Kurt
Title: Re: [Mod] Random image / Zufallsbild
Post by: yogi on May 06, 2007, 03:52:14 PM
hier nochmal ein shot der die anzeige nach dem includen anzeigt.das hilft dir vielleicht weiter.
http://michel-juergen.de/shot/4im3.gif (http://michel-juergen.de/shot/4im3.gif)

da zeigt er mir jetzt das an.

Gruß
Yogi

ah, noch was: IFrame will er auch nicht oder ich machs verkehrt,was ich mir aber nicht vorstellen kann.
Title: Re: [Mod] Random image / Zufallsbild
Post by: yogi on May 08, 2007, 06:41:31 AM
Normal hab ich nie Probleme so eine Datei in eine Box einzubauen.Woran kann dies liegen.Bitte helft mir?
Title: Re: [Mod] Random image / Zufallsbild
Post by: KurtW on May 08, 2007, 04:04:28 PM
Hasllo,

wie auch im Bild zu sehen, stimmen die Pfade nicht.
Da kann man das Ding auch nicht per iframe einbauen.  :wink:
Aber da drauf hab ich auch schon 2 Posts vorher hingewiesen mit dem Direktlink auf die random.php


gruß
Kurt
Title: Re: [Mod] Random image / Zufallsbild
Post by: yogi on May 09, 2007, 08:25:13 PM
So,nach langem hin und her hab ichs drin.
Mit IFrame.
Jetzt hab ich nur noch ein schönheitsproblem.
Das Bild sollte mittig angezeigt werden,habe ers schon mit <center><center>probiert aber mit keinem Erfolg.

Gruß
Yogi

www.michel-juergen.de
Title: Re: [Mod] Random image / Zufallsbild
Post by: mawenzi on May 09, 2007, 08:45:30 PM
... ich sehe nur ... <div style="text-align:center;"></div><a href="./ ...
... und nicht ... <center><a href="./ ... </a></center> ....
... da kann dann auch nichts mittig angeordnet werden ... ;)
Title: Re: [Mod] Random image / Zufallsbild
Post by: yogi on May 10, 2007, 06:59:53 AM
Danke,
jetzt bin ich zufrieden.
Nun such ich mir das nächste Mod. ( Herausforderung ).
Mich würde nur interessieren warum ich das Teil nicht INCLUDEN konnte.

Gruß
Yogi
Title: Re: [Mod] Random image / Zufallsbild
Post by: Momo on May 10, 2007, 11:52:46 AM
Schlagt mich, aber ich habe nicht alle 27 Seiten komplett durchgelesen, nur 12. Mein Problem ist offenbar grundsätzlich ein Verständnisproblem. IUch habe die random.php, die funktioniert gut. Ich will das Bild auf der Startseite eines PHPBB-Forums anzeigen lassen. Wie binde ich das jetzt ein? Ein include wohin genau? Ich kapiers nicht. Könnt Ihr mir bitte auf die Sprünge helfen?

Danke Momo
Title: Re: [Mod] Random image / Zufallsbild
Post by: mawenzi on May 10, 2007, 12:09:06 PM
@yogi
... includen geht nur bei der gleichen Root/Domain der Dateien ...

@Momo
... an die Stelle in deinem PHPBB-Template, wo das Zufallsbild erscheinen soll ...
Title: Re: [Mod] Random image / Zufallsbild
Post by: Momo on May 10, 2007, 01:14:09 PM
Danke, aber das klappt gar nicht.

Dazu kommt: Ich stehe vor einem absoluten Rätsel. Ich habe es per iframe eingebunden, hat auch geklappt. Als ich die Position korrigieren wollte, ging nichts mehr. Es lässt sich nicht mehr ändern. Ich habe es jetzt rausgelöscht, in einem anderen Template eingefügt, meinen Cache gelöscht, verschiedene Browser ausprobiert, bin sogar an einen anderen rechner gegangen: Überall das gleiche. Die Anzeige ist drin obwohl der Befehl raus ist. Jetzt ist sie außerdem noch im Footer drin, weil ich es da testen wollte. An beiden Stellen kann ich es nicht mehr entfernen. Habe schon den Apachen vom Server neu gestartet, alles versucht. Es ist definitiv unmöglich, dass es noch angezeigt werden kann. Wird es aber. Werde ich jetzt verrückt?

Title: Re: [Mod] Random image / Zufallsbild
Post by: mawenzi on May 10, 2007, 01:51:04 PM
@Momo
... ja, ein Link wäre ( wie immer und im "How to use" zu lesen...) sehr hilfreich ...
... und meine Info an yogi auch mal für dich durchdacht ... ?
Title: Re: [Mod] Random image / Zufallsbild
Post by: yogi on May 11, 2007, 06:57:44 AM
Kurz nochmal einmischen.
Mit Includen bin ich auch nicht hingekommen.Das hat zwar funktioniert,hat mir aber alle anderen Boxen im Portal dunkel gemacht.Weiß ja auch nicht warum.
Mit IFrame hat es geklappt und mit dem zentrieren auch.
Im Normalfall nehme ich solche php scripte und Bau die so in die Boxen ein wie sie geschrieben sind und das funzt dann auch immer.Warum dieses Script nicht läuft - keine Ahnung.
Naja,mit dieser Lösung kann ich leben.

Gruß
Yogi
Title: Re: [Mod] Random image / Zufallsbild
Post by: joombler on June 10, 2007, 03:28:55 PM
Oder musstest du die Pfade ändern, damit die random images in deiner Page angezeigt werden?

Ja, stimmt; this is what I changed:

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

dann geht es schon gans schön loss :-)
Jos
Title: Re: [Mod] Random image / Zufallsbild
Post by: joombler on June 10, 2007, 03:33:19 PM
gerne, gerne..
ist ja selbstveständlich..

Nicky,
Ich habe schon etwat Bilder und Filmchen online. Konnen sie mir erzählen wie ich statt 'no thumbnail' der Icone von zB wmv.gif (icon Directory) dafür im Bild bekomme?

danke,
Jos
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on June 11, 2007, 11:20:57 PM
hey Jos,
try in english. because german translation have no sense for your question ;)
Title: Re: [Mod] Random image / Zufallsbild
Post by: schnubbie on June 25, 2007, 03:06:16 PM
Hi@all

ich würde gerne statt Thumbnails 1 großes Bild anzeigen lassen. Ich habe die Frage schonmal in diesem Thread gelesen, aber noch keine Antowrt gefunden ( überlesen?)
Das ist sicher was ganz einfaches für euch  :)

From Google Translator:
I would let 1 large picture indicate gladly instead of Thumbnails. I read the question already  in this Thread, but found still no answer (overlooked?) That is reliably which completely simple for you
Title: Re: [Mod] Random image / Zufallsbild
Post by: seanie morris on July 06, 2007, 07:34:13 PM
Hi guys,

I've been a browser of this forum for weeks now, but this happens to be my first post! Trust a newbie to put it into a not-so-help forum first! ;)

I have downloaded Nicky's text file (many thanks for making the MOD). But, the problem is trying to get it installed. The 'index' file I wish to get it on is here (it is just a test page for now):

http://www.tullamorelife.net/index2.html

I uploaded the 'random.php' file (from Nicky's text file) to the default directory, but I cannot make it work. In the file, doesn't it ask to designate the ROOT_PATH's? I've tried combinations but no luck.

Can anyone please steer me towards the right direction?

 :?:

Seanie.
Title: Re: [Mod] Random image / Zufallsbild
Post by: manurom on July 06, 2007, 08:03:11 PM
Hello, seanie, and welcome.
You put this, in your HTML code:
Code: [Select]
<?php
 
include("/random.php");
?>
as if your gallery is in the same directory than index2.html. >>:?:
The random.php file has to be at the root of your gallery.
You should then put this:
Code: [Select]
<?php
 
include("http://www.path/to/your/gallery/random.php");
?>

In an HTML page, prefer to use the IFRAME tags:
Code: [Select]
<IFRAME src="http://www.path/to/your/gallery/random.php" width=200 height=200 scrolling=no frameborder=0 > </IFRAME>
Title: Re: [Mod] Random image / Zufallsbild
Post by: seanie morris on July 07, 2007, 04:50:30 PM
Hello, seanie, and welcome.

Thanks for the welcome manurom!

In an HTML page, prefer to use the IFRAME tags:
Code: [Select]
<IFRAME src="http://www.path/to/your/gallery/random.php" width=200 height=200 scrolling=no frameborder=0 > </IFRAME>

I am not having any success with this. the index2.html file is there to view still. What I have done is tried placing random.php in different folders on the server, and ammending the path accordingly each time in the document (and thus alsoupploading it too). On the server, all the 4Images content is in a "4images" folder or directory. I believe the gallery is in the "data" folder, and in there is a "thumbnails" folder (amongst others). So, unless I am doing something wrong, the lines of code in 'index2.html' should appear as:

Code: [Select]
<td valign="top"><p align="center" style="font-weight: bold; color: #990000; font-size: 12px">TL&amp;C News!</p>
                  <p>Site updates and news go here.  </p>
                  <p><IFRAME src="http://www.tullamorelife.net/4images/data/thumbnails/random.php" width=200 height=200 scrolling=no frameborder=0></IFRAME></p></td>
              </tr>
            </table></td>

As I said, I have tried placing "random.php" into different folders, but since your iFrames suggestion as well, I STILL can't get it to work!

 :(
Title: Re: [Mod] Random image / Zufallsbild
Post by: manurom on July 07, 2007, 06:49:07 PM
Hello again;
I use to put the "random.php" file at the root of my gallery.
So it should be, for you, assuming you put this file at there: http://www.tullamorelife.net/4images/random.php:
Code: [Select]
<td valign="top"><p align="center" style="font-weight: bold; color: #990000; font-size: 12px">TL&amp;C News!</p>
                  <p>Site updates and news go here.  </p>
                  <p><IFRAME src="http://www.tullamorelife.net/4images/random.php" width=200 height=200 scrolling=no frameborder=0></IFRAME></p></td>
              </tr>
            </table></td>

I also use to set the ROOT PATH in random.php as above:
Code: [Select]
<?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''./'); //because it is at the root of the gallery

In  PHP environment I link to it like there:
Code: [Select]
<?php
 
include("http://path/to/my/gallery/random.php");
?>

and I use IFRAMES in HTML sites.

And it always work fine for me.
Title: Re: [Mod] Random image / Zufallsbild
Post by: seanie morris on July 08, 2007, 05:18:00 PM
Manurom et all,
your help has worked, I can now get a random thumbnail to display. However, I need some further tips if anyone can guide me.

I have implemented the iFrame. However, as the thumbnail acts as a link to the larger picture, how do I change the link target path, either to go to e.g. the Gallery introduction page of my site, or even to the 4Images Gallery directly? I also wish to change the font type which appears as the caption under the thumbnail (it is currently defaulting to Times New Roman, size 12, which is not on my site).

I am sorry to pester you with such trivial problems, but I have not dabbled in iFrames before (just good old html so far for me!). Thanks for the help (and a great tool that is 4Images) so far.

Seanie.
Title: Re: [Mod] Random image / Zufallsbild
Post by: manurom on July 09, 2007, 01:53:13 AM
Well, seanie morris;
try this:
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";
echo "<b>$image_name</b><br>\n";
echo "Comments: $image_comments<br>\n";
?>

and if you need to have a verdana font (I can't figure what font you use), change these last lines to:
Code: [Select]
echo "<a href=\"".ROOT_PATH."details.php?image_id=$image_id\" target=\"_blank\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
echo "<b><font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"-1\">$image_name</font></b><br>\n";
echo "<font face=\"Verdana, Arial, Helvetica, sans-serif\" size=\"-1\">Comments: $image_comments</font><br>\n";
?>
Title: Re: [Mod] Random image / Zufallsbild
Post by: manurom on July 09, 2007, 03:57:17 PM
 :oops: What a fool I am!
how do I change the link target path, either to go to e.g. the Gallery introduction page of my site, or even to the 4Images Gallery directly?

To change the target path, if you desire visitors to go to your gallery homepage, please search this line in the file "random.php":
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";and change it to:
Code: [Select]
echo "<a href=\"".ROOT_PATH."index.php\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
Sorry again, I have forgotten this part of your question.
Title: Re: [Mod] Random image / Zufallsbild
Post by: seanie morris on July 10, 2007, 01:16:23 AM
Manurom,
your help has been invaluable, thanks for the tips - they have all helped. I have learned a few more tricks thanks to you. If I could repay the favours, I would. Thanks again!

Seanie.

P.S. I am tweaking some of the templates in 4Images at the moment, but the rest of the site is now up and running -> www.tullamorelife.net.

 :)
Title: Re: [Mod] Random image / Zufallsbild
Post by: SilverNavigator on July 26, 2007, 09:27:23 PM
Hallo,

ich habe ein Problem.

Und zwar erscheint bei dem Internet Explorer ein weißer Hintergrund, beim Firefox allerdings nicht.

Siehe www.promillepics.de oben rechts.



Was muss geändert werden ?
Title: Re: [Mod] Random image / Zufallsbild
Post by: ashfaq on July 29, 2007, 03:46:19 AM
Nicky dear thank for this mod, would you plz like to tell me how to control thumb size and number of thumbs to show in my other site, Assume my gallery thumb size is 130pixel and i wanna show random.php thumb in 150 pixel in other site.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Jan-Lukas on July 29, 2007, 11:39:00 AM
Hallo,

ich habe ein Problem.

Und zwar erscheint bei dem Internet Explorer ein weißer Hintergrund, beim Firefox allerdings nicht.

Siehe www.promillepics.de oben rechts.



Was muss geändert werden ?

Du kannst in der random.php gleich den Hintergrund angeben, den deine Seite auch hat

z.B. immer vor dem <?php

<body bgcolor="425d9b">
<?php

Ich stelle anderen Seiten meine Box zur Verfügung, und so kann ich jede Seite individuell anpassen.
dann bekommt jede Random einen anderen Namen
Title: Re: [Mod] Random image / Zufallsbild
Post by: computer123 on August 07, 2007, 11:10:42 PM
Hallo,

How can I add my additional field to the Thumb of Random Image?


PS: I could add the additional field to the normal thumb and Mini top thumb but not under the thumb of Random Image.

Thank you for any help
Title: Re: [Mod] Random image / Zufallsbild
Post by: thunderstrike on August 07, 2007, 11:45:46 PM
Ok. I download random.txt file.

This is what need:

Quote
$number = ($total_images > 1) ? mt_rand(0, $total_images - 1) : 0;

after - add:

Quote
$additional_sql = "";
if (!empty($additional_image_fields)) {
  foreach ($additional_image_fields as $key => $val) {
    $additional_sql .= ", a.".$key;
  }
}

Find:

Quote
$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments

replace:

Quote
$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments" . $additional_sql . "

[ Edit ]
Title: Re: [Mod] Random image / Zufallsbild
Post by: computer123 on August 08, 2007, 01:58:40 AM
Hello thunderstrike ,

Thank you for your support.

I tried what you said to me but it does not work.

Do you have another solution please?

Cheers
Title: Re: [Mod] Random image / Zufallsbild
Post by: thunderstrike on August 08, 2007, 02:31:35 AM
Quote
I tried what you said to me but it does not work.

What this does not work ? Is say ?
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on August 13, 2007, 12:50:36 AM
Nicky dear thank for this mod, would you plz like to tell me how to control thumb size and number of thumbs to show in my other site, Assume my gallery thumb size is 130pixel and i wanna show random.php thumb in 150 pixel in other site.

hi ashfaq,

use width=\"123456\" height=\"123456"\
in
<img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\">
Title: Re: [Mod] Random image / Zufallsbild
Post by: thunderstrike on August 13, 2007, 01:21:24 AM
Oh ! so see the mean now.

Quote
<img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\" width=\"123456\" height=\"123456\">

for:

Quote
$imgtable_width = ceil(intval($config['image_table_width']) / $config['image_cells']);
<img src=\"".$thumb_src."\" border=\"0\" width=\"".$imgtable_width."\" alt=\"$image_name\">

;)
Title: Re: [Mod] Random image / Zufallsbild
Post by: ashfaq on August 29, 2007, 06:08:49 PM
I have a stupid question, what to put in place here
define('ROOT_PATH', './4images/');

Shoul we have to put our site url here ? like
define('http://www.mydomain.com/');
Title: Re: [Mod] Random image / Zufallsbild
Post by: thunderstrike on August 29, 2007, 06:10:17 PM
Quote
define('ROOT_PATH', './4images/');

After <?php tag at top. ;)
Title: Re: [Mod] Random image / Zufallsbild
Post by: ashfaq on August 29, 2007, 06:39:22 PM
Quote
define('ROOT_PATH', './4images/');

After <?php tag at top. ;)

Cant understand, plz explain little bit more, infact i am not good in php so plz help.
you mean put it here
// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
Like
http://www.mydomain.com
Title: Re: [Mod] Random image / Zufallsbild
Post by: thunderstrike on August 29, 2007, 06:47:31 PM
Open PHP file.

Code: [Select]
<?php

add after:

Code: [Select]
define('ROOT_PATH', './4images/');

Easy. ;)
Title: Re: [Mod] Random image / Zufallsbild
Post by: ashfaq on August 30, 2007, 02:58:43 AM
Thanks bro for help, plz just give an example by putting domain path, plz
Title: Re: [Mod] Random image / Zufallsbild
Post by: thunderstrike on August 30, 2007, 03:03:46 AM
Domain name - includes/constants.php file - 1st line: SCRIPT_URL (uncomment +  add URL). After, use SCRIPT_URL in ROOT php file. ;)
Title: Re: [Mod] Random image / Zufallsbild
Post by: ashfaq on August 30, 2007, 04:22:28 AM
I am totally confused, plz give an example by putting temporary domain like www.mydomain.com in code

I am using this random.php code.

Code: [Select]
<?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/');

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)) ? 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";
?>
Title: Re: [Mod] Random image / Zufallsbild
Post by: thunderstrike on August 30, 2007, 05:34:10 AM
In includes/constants.php file,

find:

Quote
// define('SCRIPT_URL', 'http://www.yourdomain.com/4images'); //no trailing slash

change:

Quote
define('SCRIPT_URL', 'http://www.yourdomain.com/4images'); //no trailing slash

and change http://www.yourdomain.com/4images for your full URL.

In random.php file,

find:

Quote
define('ROOT_PATH', './4images/');

change:

Quote
define('ROOT_PATH', SCRIPT_URL);
Title: Re: [Mod] Random image / Zufallsbild
Post by: ashfaq on August 30, 2007, 11:27:48 AM
I did the same procedure.
First Open constants.php and put my domain path.
Code: [Select]
// define('SCRIPT_URL', 'http://www.mydomain.com'); //no trailing slash
Then in random.php also change like
Code: [Select]
define('ROOT_PATH', 'http://www.mydomain.com');
After make changes both files i upload constants.php in includes folder and random.php in root path But it is not working.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on August 30, 2007, 01:29:27 PM
ashfaq,

where is your gallery? pls send url
where is random.php saved? send url
Title: Re: [Mod] Random image / Zufallsbild
Post by: thunderstrike on August 30, 2007, 02:42:54 PM
Quote
// define('SCRIPT_URL', 'http://www.mydomain.com'); //no trailing slash

Ok so do fine. Remove // at 1st after enter domain. ;)
Title: Re: [Mod] Random image / Zufallsbild
Post by: ashfaq on August 30, 2007, 05:39:10 PM
I have removed the // but the problem is there.

Check Gallery Link:
http://www.deskbeauty.com/ (http://www.deskbeauty.com/)

Check random.php Link
http://www.deskbeauty.com/random.php (http://www.deskbeauty.com/random.php)

you wil see error at random wallpaper at right sidebar top and at page end, infact i am showing random wallpaper code of another site and that wallpaper site is down so it is giving error, you can see that i wanna show one random wallpaper at right side top and four random wallpapers at bottom. Plz tell me how to solve random wallpaper so i can add random wallpapers from my own site and also show on other sites.

One more thing plz observe that my site takes much time to load, can you give suggestion how to make a template for fast page load ?
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on August 30, 2007, 07:18:01 PM
hi,

ORIGINAL random.php

set
Code: [Select]
define('ROOT_PATH', './');

upload your ORIGINAL constants.php again into include folder.

that's all

and please add into your footer original 4images copyright content, thank you!
Title: Re: [Mod] Random image / Zufallsbild
Post by: ashfaq on August 31, 2007, 04:23:12 AM
Thanks dear now its working. Just help me more in these issues.

1: How to get ride of wallpaper name and commnets ? i wanna show only thumbnail.
2: How to control thumbnail size.
3: How to increase or decrease number of thumbnails to show, as now we can only show one thumbnail.

and lastly this question is not related with random wallpaper but i hope you will also help in this issue, plz tell me how to show total number of wallpapers at my site and any other information about site.

Thanks Again.
Title: Re: [Mod] Random image / Zufallsbild
Post by: ashfaq on September 02, 2007, 02:57:16 AM
Thanks dear now its working. Just help me more in these issues.

1: How to get ride of wallpaper name and commnets ? i wanna show only thumbnail.
2: How to control thumbnail size.
3: How to increase or decrease number of thumbnails to show, as now we can only show one thumbnail.

and lastly this question is not related with random wallpaper but i hope you will also help in this issue, plz tell me how to show total number of wallpapers at my site and any other information about site.

Thanks Again.

Will anyone plz help, specially nicky bro
Title: Re: [Mod] Random image / Zufallsbild
Post by: ashfaq on September 02, 2007, 06:37:17 PM
Nicky dear i have solved all problems and using your code to show 4 random thumbnails on other site, plz tell me how to show thumbnails horizontally bcoz thumbnails appear vertically ?
When i try to open random.php in any other site by include command it show broken image but if i check it in 4images site, it works good so tell me how to show random thumbnails in other site ?
I think you told me to put ./
Code: [Select]
define('ROOT_PATH', './');in random.php and in my opinion this thing show thumbnails in 4images site but prevent to appear in other sites and show a broken images.

Plz bro help me i will be very thankfull to you.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on September 03, 2007, 10:25:24 AM
if you want to call random.php from http://www.deskbeauty.com/test77/
and from http://www.deskbeauty.com/

than you need to have 2 random files...

one with
Code: [Select]
define('ROOT_PATH', './');

Code: [Select]
define('ROOT_PATH', '../');


for horiz. thumbs... remove <br> from echo call..

and pls.. do not pm me ;)
just wait for the answer.

thx & have a nice day
Title: Re: [Mod] Random image / Zufallsbild
Post by: ashfaq on September 04, 2007, 04:31:58 AM
Bro first of all sory that i pm you, inface no one was helping so i pm you.

Random.php works good if it is used in 4images directory but didnt work when we call in by include command in any other site.
I have also put ../ in random.php but it didnt work in 4images directory nor in any other site but ./  work in 4images directory but not work other site.

Check the site here: www.deskbeauty.com
Check the random file where i put ../: www.deskbeauty.com/random1.php
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on September 04, 2007, 08:08:33 PM
ok..

where you want that random pics should be showed?
exact urls...

and 2nd time.. please change 4images copyright notice in your footers..
Title: Re: [Mod] Random image / Zufallsbild
Post by: ashfaq on September 06, 2007, 05:17:40 PM
Infact bro i dont want to show random images on a specific site but i want a link code that other webmaster can put in there sites and show my site random wallpapers, as you know this thing is good for site promotion, so i hope you will help as this is very important for 4homepages webmasters. Thanks
Title: Re: [Mod] Random image / Zufallsbild
Post by: ashfaq on September 10, 2007, 06:15:12 PM
Infact bro i dont want to show random images on a specific site but i want a link code that other webmaster can put in there sites and show my site random wallpapers, as you know this thing is good for site promotion, so i hope you will help as this is very important for 4homepages webmasters. Thanks

Plz help someone with this issue.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on September 10, 2007, 10:25:02 PM
http://www.4homepages.de/forum/index.php?topic=1020.msg4347#msg4347

and for other sites use something like this.. http://www.4homepages.de/forum/index.php?topic=1020.msg6794#msg6794
Title: Re: [Mod] Random image / Zufallsbild
Post by: ashfaq on September 11, 2007, 02:39:53 AM
Dear thanks for reply but your given links most post or not in english so i cant understand, plz just tell me how to show random wallpaper on any other site ?
Title: Re: [Mod] Random image / Zufallsbild
Post by: thunderstrike on September 11, 2007, 03:32:49 AM
Quote
and for other sites use something like this.. http://www.4homepages.de/forum/index.php?topic=1020.msg6794#msg6794

Quote
most post or not in english so i cant understand

This english ... what is prob ?
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on September 11, 2007, 08:27:39 AM
ashfaq,

both posts are IN ENGLISH, look better  :evil: :cry:
Title: Re: [Mod] Random image / Zufallsbild
Post by: thunderstrike on September 11, 2007, 11:53:16 AM
@Nicky:

http://www.4homepages.de/forum/index.php?topic=1020.msg4347#msg4347

post msg4347 is german.
Title: Re: [Mod] Random image / Zufallsbild
Post by: mawenzi on September 11, 2007, 12:17:54 PM
@thunderstrike
... the post is also in englisch ...
Quote
... (E: try this) ...
... (E: in random.php) ...
... (E: after) ...
... (E: add this(ofcourse your own url)) ...
... (E: change) ...
... (E: to) ...
... Nicky say ... E: -> in english ... ;)
Title: Re: [Mod] Random image / Zufallsbild
Post by: thunderstrike on September 11, 2007, 12:24:04 PM
Ohh ! ok - thank.
Title: Re: [Mod] Random image / Zufallsbild
Post by: ashfaq on September 12, 2007, 04:52:09 AM
okay


probier mal das(E: try this)

in der random.php (E: in random.php)
nach (E: after)
Code: [Select]
include(ROOT_PATH.'includes/constants.php');

füge dies ein (E: add this(ofcourse your own url))
Code: [Select]
define('SCRIPT_URL', 'http://www.brinkmann-online.de/umleitung/4images/');

dann ändere (E: change):
Code: [Select]
$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";

auf (E: to):
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";

Thanks bro this code works but it only works if we wanna show 1 thumb and it didnt work to show 4random thumbs code file "random_more_pics.txt " which i downloaded from nicky.net
How to implement code to show 4 random thumbs on other site ?
Title: Re: [Mod] Random image / Zufallsbild
Post by: janaage01 on September 23, 2007, 12:09:54 AM
Ich habe mal eine allgemeine Frage zu dem Script:

Werden die Originalbilder oder die Thumbnails als "Random Images" agezeigt?
Title: Re: [Mod] Random image / Zufallsbild
Post by: thunderstrike on September 23, 2007, 01:01:03 AM
Quote
$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";

Change for:

Code: [Select]
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : format_url($script_url . "/data/" . THUMB_DIR."/".$cat_id."/".$row['image_thumb_file']);

echo "<a href=\"". format_url($script_url ."/details.php?image_id=" . $image_id) . "\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"" . $image_name . "\"></a><br>\n";
Title: Re: [Mod] Random image / Zufallsbild
Post by: janaage01 on September 23, 2007, 10:45:01 AM
Quote
$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";

Change for:

Code: [Select]
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : format_url($script_url . "/data/" . THUMB_DIR."/".$cat_id."/".$row['image_thumb_file']);

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


Ist das die Antwort auf die Frage ob und wie die Thumbnails statt den Originalbildern angezeigt werden?
Title: Re: [Mod] Random image / Zufallsbild
Post by: thunderstrike on September 23, 2007, 12:30:46 PM
Dieses antwort ist für dieses ein:

okay


probier mal das(E: try this)

in der random.php (E: in random.php)
nach (E: after)
Code: [Select]
include(ROOT_PATH.'includes/constants.php');

füge dies ein (E: add this(ofcourse your own url))
Code: [Select]
define('SCRIPT_URL', 'http://www.brinkmann-online.de/umleitung/4images/');

dann ändere (E: change):
Code: [Select]
$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";

auf (E: to):
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";

Thanks bro this code works but it only works if we wanna show 1 thumb and it didnt work to show 4random thumbs code file "random_more_pics.txt " which i downloaded from nicky.net
How to implement code to show 4 random thumbs on other site ?
Title: Re: [Mod] Random image / Zufallsbild
Post by: beach-baer on September 30, 2007, 01:06:03 PM
Moin Moin!

Ich habe schon länger so ein Mod gesucht, habe diesen hier aber nicht gleich auf Anhieb gefunden. Nun ist er aber auf meiner HP eingebunden und ich bin begeistert.

Kleines Ding mit großer Wirkung - Supersache!

Und ich wollte einfach nur einmal > Vielen Dank < sagen!

und viele Grüße aus Hamburg

Kay
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on September 30, 2007, 08:47:25 PM
gerne :)
Title: Re: [Mod] Random image / Zufallsbild
Post by: FunnyUser on November 21, 2007, 07:30:32 AM
Hey guys,
nice MOD!

My "thumbnails_bit.html" looks like that:

Code: [Select]
<a href="{image_url}" onmouseover="popup1('<img src=http://myDOMAIN.de/data/thumbnails/{cat_id}/{thumbnail_file_name}>','0')"; onmouseout="kill()" target="_blank">{image_name}</a>
I show up my thumbnails when user "mouseover" the imagename.

Is there any possibility to include my "thumbnails_bit.html - code" in this part of script:
Code: [Select]
echo "<a href=\"".ROOT_PATH."details.php?image_id=$image_id\" target=\"_new\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";   


Thanks a lot for your help!

Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on November 22, 2007, 11:05:47 AM
hi FunnyUser
Hey guys,
nice MOD!

My "thumbnails_bit.html" looks like that:

Code: [Select]
<a href="{image_url}" onmouseover="popup1('<img src=http://myDOMAIN.de/data/thumbnails/{cat_id}/{thumbnail_file_name}>','0')"; onmouseout="kill()" target="_blank">{image_name}</a>
I show up my thumbnails when user "mouseover" the imagename.

Is there any possibility to include my "thumbnails_bit.html - code" in this part of script:
Code: [Select]
echo "<a href=\"".ROOT_PATH."details.php?image_id=$image_id\" target=\"_new\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";   
Thanks a lot for your help!


try this

Code: [Select]
echo "<a href=\"".ROOT_PATH."details.php?image_id=$image_id\" onmouseover=\"popup1('<img src=".$thumb_src.">','0')\"; onmouseout=\"kill()\" target=\"_blank\">".$image_name."</a>\n";
Title: Re: [Mod] Random image / Zufallsbild
Post by: thunderstrike on November 22, 2007, 06:31:48 PM
$image_name = $row['image_name']

so

try this:

Code: [Select]
echo "<a href=\"".ROOT_PATH."details.php?image_id=$image_id\" onmouseover=\"popup1('<img src=".$thumb_src.">','0')\"; onmouseout=\"kill()\" target=\"_blank\">".format_text(trim($image_name), 2)."</a>\n";
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on November 22, 2007, 06:39:34 PM
thunderstrike,

FYI
$image_name = $row['image_name'];
is on the 1st page from this MOD in random.txt file

no matter if you use now format_text or not.
Title: Re: [Mod] Random image / Zufallsbild
Post by: thunderstrike on November 22, 2007, 06:49:54 PM
Quote
FYI
$image_name = $row['image_name'];
is on the 1st page from this MOD in random.txt file

Ok so use:

Code: [Select]
$image_name = format_text(trim($row['image_name']), 2);

Please see includes/functions.php (show_image function of Jan)
Title: Re: [Mod] Random image / Zufallsbild
Post by: FunnyUser on November 23, 2007, 03:01:16 PM
Quote
FYI
$image_name = $row['image_name'];
is on the 1st page from this MOD in random.txt file

Ok so use:

Code: [Select]
$image_name = format_text(trim($row['image_name']), 2);

Please see includes/functions.php (show_image function of Jan)

I'm a bit confused now  :roll: :roll: :roll:

Can anybody explain to me how I have to do the changes.
I have the original "random.php" from Nicky and want to showup my thumbsnails like in my "thumbnail_bit.html".



Thanks youuuu!!!!
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on November 23, 2007, 03:04:17 PM
did you try that
http://www.4homepages.de/forum/index.php?topic=1020.msg105488#msg105488
Title: Re: [Mod] Random image / Zufallsbild
Post by: FunnyUser on November 23, 2007, 03:30:57 PM
did you try that
http://www.4homepages.de/forum/index.php?topic=1020.msg105488#msg105488

Okay, I guess it works!
But where I have to put the <SCRIPT-CODE>. It looks like this:
Code: [Select]
<script language="JavaScript">
<!--
blink(0.7);

function blink(speed)
{
if (speed) {
if (document.all)
setInterval("blink()", speed*1000)
return;
}
var blink = document.all.tags("BLINK")
for (var i=0; i<blink.length; i++)
blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden" : ""
}

// -->
</script>

<script language="JavaScript">
<!--

function SymError()
{
  return true;
}

window.onerror = SymError;

//-->
</script>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<SCRIPT TYPE="text/javascript">
<!--

Xoffset= 16; // modify these values to ...
Yoffset= 16; // change the popup position.

var old,skn,iex=(document.all),yyy=-1000;

var ns4=document.layers
var ns6=document.getElementById&&!document.all
var ie4=document.all

if (ns4)
skn=document.dek
else if (ns6)
skn=document.getElementById("dek").style
else if (ie4)
skn=document.all.dek.style
if(ns4)document.captureEvents(Event.MOUSEMOVE);
else{
skn.visibility="visible"
skn.display="none"
}
document.onmousemove=get_mouse;

function popup1(msg,bak){
var content="<TABLE WIDTH=70 BORDER=1 bordercolor=#000000 CELLPADDING=0 CELLSPACING=0><TD ALIGN=center><FONT COLOR=black SIZE=2>"+msg+"</FONT></TD></TABLE>";
yyy=Yoffset;
if(ns4){skn.document.write(content);skn.document.close();skn.visibility="visible"}
if(ns6){document.getElementById("dek").innerHTML=content;skn.display=''}
if(ie4){document.all("dek").innerHTML=content;skn.display=''}
}

function get_mouse(e){
var x=(ns4||ns6)?e.pageX:event.x+document.body.scrollLeft;
skn.left=x+Xoffset;
var y=(ns4||ns6)?e.pageY:event.y+document.body.scrollTop;
skn.top=y+yyy;
}

function kill(){
yyy=-1000;
if(ns4){skn.visibility="hidden";}
else if (ns6||ie4)
skn.display="none"
}

//-->
</SCRIPT>

Or can I just do "<? include("http://www.domain.com/random.php") ?>" ??

At the moment my <SCRIPT-CODE> is in my "header.html".
...or has it do be in the "random.php" ??


Thanks
Title: Re: [Mod] Random image / Zufallsbild
Post by: djith on December 17, 2007, 07:03:16 PM
someone an idea how to NOT include a certain category in the random pictures ?
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on December 17, 2007, 07:38:58 PM
put this into both queries

example
Code: [Select]
AND a.cat_id NOT IN (4, 9, 15)

4,9,15 are only example, change it with your cat_id 's
Title: Re: [Mod] Random image / Zufallsbild
Post by: djith on December 17, 2007, 09:32:17 PM
Thank you for fast reply. I'm using 1.7.1 the original version and there is no such as random.php among the files... maybe in sessions??
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on December 18, 2007, 08:09:07 AM
hmm...

are you writing about the random pics MOD or general about 4images random?
Title: Re: [Mod] Random image / Zufallsbild
Post by: djith on December 18, 2007, 10:49:20 AM
{random_image} was standard with the template... don't think it was a MOD.
There was a topic about it long time ago but can't find it ... was 3 years ago i think.
 
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on December 18, 2007, 11:07:25 AM
;)

in this thread we talking about the MOD for external site
Title: Re: [Mod] Random image / Zufallsbild
Post by: djith on December 18, 2007, 11:11:21 AM
kk... will look further on the forum to find the topic :)
Title: Re: [Mod] Random image / Zufallsbild
Post by: glitzer on December 27, 2007, 02:57:38 PM
HI
hat super geklappt und bin happy damit
Gut gefallen würde es mir noch, wenn die bilder per javascript von rechts nach link oder umgekehrt langsam wandern würden.

hat jemand eine idee?
lg
glitzer
Title: Re: [Mod] Random image / Zufallsbild
Post by: skiemor on December 28, 2007, 09:43:57 AM
put this into both queries

example
Code: [Select]
AND a.cat_id NOT IN (4, 9, 15)

4,9,15 are only example, change it with your cat_id 's

Hi Nicky, where and how exactly I have to code this to exclude categories. Which file, which place?

And who to exlude categories internal? I won't to show media-thumbs in random.

Thanks Chris.
Title: Re: [Mod] Random image / Zufallsbild
Post by: bigwave on December 30, 2007, 04:09:40 AM
This is what I need I think. I'd like to put a random thumbnail of my 1.74 gallery into my wordpress 2.31 blog in the new k2 template sidebar.  I have random.php working

http://www.maui-tropica.com/maui-tropica-gallery/random.php

but when I insert:

<?php
 include("http://www.maui-tropica.com/maui-tropica-gallery/random.php");
?>

into the sidebar I get these errors:

Warning: include() [function.include]: URL file-access is disabled in the server configuration in /home/bigwave/public_html/hawaii-agriculture/hawaii-agriculture-blog/wp-content/themes/k2/app/modules/php.php(7) : eval()'d code on line 2

Warning: include(http://www.maui-tropica.com/maui-tropica-gallery/random.php) [function.include]: failed to open stream: no suitable wrapper could be found in /home/bigwave/public_html/hawaii-agriculture/hawaii-agriculture-blog/wp-content/themes/k2/app/modules/php.php(7) : eval()'d code on line 2

Warning: include() [function.include]: Failed opening 'http://www.maui-tropica.com/maui-tropica-gallery/random.php' for inclusion (include_path='.:/usr/lib/php') in /home/bigwave/public_html/hawaii-agriculture/hawaii-agriculture-blog/wp-content/themes/k2/app/modules/php.php(7) : eval()'d code on line 2

I'm very new at this.  Is there something I should change in php.php to get this mod functioning or is it just not happy?  This mod is obviously the result of lots of hard work--thanks for the effort!  Here is my php.php code I case sombody knows the fix for my situation:
Code: [Select]
<?php

function php_sidebar_module($args) {
extract($args);

echo($before_module $before_title $title $after_title);
eval(' ?>
' . sbm_get_option('code') . '<?php ');
echo($after_module);
}

function php_sidebar_module_control() {
if(isset($_POST['
php_module_code'])) {
sbm_update_option('
code', stripslashes($_POST['php_module_code']));
} ?>

<p>
<label for="php-module-code"><?php _e('Module\'s code:''k2_domain'); ?></label><br />
<textarea id="php-module-code" name="php_module_code" rows="6" cols="30"><?php echo(wp_specialchars(htmlspecialchars(sbm_get_option('code'), ENT_QUOTES), 1)); ?></textarea>
</p>
<?php
}

register_sidebar_module('Text, HTML and PHP''php_sidebar_module''sb-php');
register_sidebar_module_control('Text, HTML and PHP''php_sidebar_module_control');

?>


Thanks very much!
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on December 30, 2007, 02:38:37 PM
hi bigwave.

you are trying to include with a URL not with PATH = wrong.

this is PATH: /home/bigwave/public_html/hawaii-agriculture/hawaii-agriculture-blog/
this is URL: http://www.maui-tropica.com/maui-tropica-gallery/

if both domains are on same server try this to include into wordpress

example (i don't know your structure)
Code: [Select]
<?php
 
include("/home/bigwave/public_html/maui-tropica/maui-tropica-gallery/random.php");
?>

Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on December 30, 2007, 02:41:14 PM
put this into both queries

example
Code: [Select]
AND a.cat_id NOT IN (4, 9, 15)

4,9,15 are only example, change it with your cat_id 's

Hi Nicky, where and how exactly I have to code this to exclude categories. Which file, which place?

And who to exlude categories internal? I won't to show media-thumbs in random.

Thanks Chris.

hi Chris,

under both
Code: [Select]
        AND b.auth_viewimage=".AUTH_ALL."

and offcourse in random.php ;)
Title: Re: [Mod] Random image / Zufallsbild
Post by: bigwave on December 31, 2007, 12:03:29 AM
Hey Nicki, Thanks!

Its down to 2 errors from three and I think it will be happy soon!

http://hawaii-agriculture.com/hawaii-agriculture-blog/

Using :

<?php
 include("/public_html/maui-tropica/maui-tropica-gallery/random.php");
?>

I get just these errors:

Warning: include(/public_html/maui-tropica/maui-tropica-gallery/random.php) [function.include]: failed to open stream: No such file or directory in /home/bigwave/public_html/hawaii-agriculture/hawaii-agriculture-blog/wp-content/themes/k2/app/modules/php.php(7) : eval()'d code on line 2

Warning: include() [function.include]: Failed opening '/public_html/maui-tropica/maui-tropica-gallery/random.php' for inclusion (include_path='.:/usr/lib/php') in /home/bigwave/public_html/hawaii-agriculture/hawaii-agriculture-blog/wp-content/themes/k2/app/modules/php.php(7) : eval()'d code on line 2

With everything else I get a ton of errors

Thanks again!
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on December 31, 2007, 12:27:09 AM
okay. i will look on that after 2nd of january... going to sleep now, and tomorrow i'm out of home...
Title: Re: [Mod] Random image / Zufallsbild
Post by: thunderstrike on December 31, 2007, 03:34:46 AM
@bigwave:

If use this version for include random.php (with your projek) - is show error ? (See attach file).
Title: Re: [Mod] Random image / Zufallsbild
Post by: bigwave on December 31, 2007, 07:23:44 PM
Hey Tunderstrike—thanks for jumping in!

Yes I get the same errors with your new random.php file.

I’m worried about my path in the word press include but don’t know what to do about it or if it is even an issue:

As suggested by Nicky
<?php
 include("/home/bigwave/public_html/maui-tropica/maui-tropica-gallery/random.php");
?>

gives me 13 errors

<?php
 include("/public_html/maui-tropica/maui-tropica-gallery/random.php");
?>

only gives me the 2 errors:
http://hawaii-agriculture.com/hawaii-agriculture-blog/

but my root path to phpinfo is:

/home/bigwave/public_html/maui-tropica/maui-tropica-gallery/admin/phpinfo.php

and the complete path is mentioned in the error messages:

Warning: include(/public_html/maui-tropica/maui-tropica-gallery/random.php) [function.include]: failed to open stream: No such file or directory in /home/bigwave/public_html/hawaii-agriculture/hawaii-agriculture-blog/wp-content/themes/k2/app/modules/php.php(7) : eval()'d code on line 2

Warning: include() [function.include]: Failed opening '/public_html/maui-tropica/maui-tropica-gallery/random.php' for inclusion (include_path='.:/usr/lib/php') in /home/bigwave/public_html/hawaii-agriculture/hawaii-agriculture-blog/wp-content/themes/k2/app/modules/php.php(7) : eval()'d code on line 2

php.php seems to be in the correct place

Anyway, thanks for the help and HAPPY NEW YEAR!

Brian
Title: Re: [Mod] Random image / Zufallsbild
Post by: rubberduck on January 22, 2008, 09:59:51 PM
Hallo

Kann evtl. jemand mal seine unter 1.7.4 lauffähige random,php posten? Hab die ersten 20 Seiten gelesen aber nichts gefunden was hilft. Ich bekomme beim Aufruf der random.php nur "Comments" angezeigt, keine Bilder.

Wäre Nett wenn das jemand posten könnte.

Danke.

Gruß Micha
Title: Re: [Mod] Random image / Zufallsbild
Post by: nobby on January 22, 2008, 10:13:32 PM
Hallo,

hier ist die Random.php im Anhang.

Es ist das Original ohne Veränderungen, ich habe sie nie Benutzt.

nobby
Title: Re: [Mod] Random image / Zufallsbild
Post by: rubberduck on January 22, 2008, 10:18:51 PM
Danke, aber leider das selbe Problem. Es wird kein Bild angezeigt. Vermute mal das es daran liegt:

Scriptversion: 1.0 for 4images 1.6.1

Bräuchte sowas was auch unter der 1.7.4 läuft.

Gruß Micha
Title: Re: [Mod] Random image / Zufallsbild
Post by: nobby on January 22, 2008, 10:22:44 PM
durch geschaut hast Du in diesem Thread schon?

nobby
Title: Re: [Mod] Random image / Zufallsbild
Post by: rubberduck on January 22, 2008, 10:29:48 PM
Hab wie geschrieben 20 Seiten durch und nachdem ich alle Änderungen eingebaut und probiert habe sah das ganze mehr aus wie die Bewohner im Dschungel Camp als wie ein Script :) Aber wie gesagt, den Fehler hab ich nicht wegbekommen.

Gruß Micha
Title: Re: [Mod] Random image / Zufallsbild
Post by: nobby on January 22, 2008, 10:39:36 PM
Nee, ich habe auch mal auf der schnelle geschaut.

Keine Anpassung an 1.7.4  :|

Da ich kein PHP-Coder bin, musst Du ein bisschen warten bis @Nicky diese
Zeilen liest und Dir dann auch helfen kann.

nobby


edit

Ich hatte noch mal in http://www.4homepages.de/forum/index.php?board=17.0 geschaut, aber auch nichts


Hilfreich wäre auch noch mal eine genaue Fehlerbeschreibung!

edit ende

Title: Re: [Mod] Random image / Zufallsbild
Post by: rubberduck on January 22, 2008, 10:48:59 PM
Hilfreich wäre auch noch mal eine genaue Fehlerbeschreibung!

Wie geschrieben, es wird nur das Wort "Comments" angezeigt, keine weitere Fehlermeldung.

Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on January 24, 2008, 09:41:24 AM
hi rubberduck,

eigentlich funktioniert das ganze auch unter 1.7.4.

zeige mir die url zur random.php
und wo hast es eingebunden
per
Code: [Select]
<?php
 
include("./random.php");
?>


und wie genau
Title: Re: [Mod] Random image / Zufallsbild
Post by: rubberduck on January 24, 2008, 11:28:45 AM
Ok, dann mal los :)

Die random.php (die aus dem .zip vom ersten Beitrag) liegt unter

Quote
http://www.reptilienmanager.de/gallery/random.php

Eingebunden ist es so:

Code: [Select]
<?php
include("gallery/random.php");
?>


Root_Path ist:

Code: [Select]
define('ROOT_PATH', '/var/www/vhosts/reptilienmanager.de/httpdocs/gallery/');
Testdatei unter:

Quote
http://www.reptilienmanager.de/test.php

Title: Re: [Mod] Random image / Zufallsbild
Post by: mawenzi on January 24, 2008, 11:36:52 AM
@rubberduck
... Root_Path sollte sein ...
Code: [Select]
define('ROOT_PATH', './');
... SCRIPT_URL sollte sein ...
Code: [Select]
define('SCRIPT_URL', 'http://www.reptilienmanager.de/gallery/');
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on January 24, 2008, 11:53:05 AM
okay... fangen wir mal an...

so kann es nicht funkionieren ;)

1.) du verbietest in deiner gallery das man sich die bilder in details anschauen kann (AND c.auth_viewimage = '".AUTH_ALL."'), ausser man ist registrierter user.

also kategorien müssen auch so eingestellt sein das die Gäste die details bilder sehen können, sonnst sind die random bilder nicht "click"-bar bzw. es werden keine in der random.php angezeigt (wie in deinem fall gerade).

wenn du nur die bilder in der test.php/random.php zeigen willst ohne es anklicken zu können
mach folgendens
Code: [Select]
        AND c.auth_viewimage = '".AUTH_ALL."'
in beiden abfragen löschen.

und dies von
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";
auf
Code: [Select]
echo "<img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"><br>\n";
ändern.

du hast die qual der wahl ;)

2.) in der random.php root path so einstellen
Code: [Select]
define('ROOT_PATH', './');

3.) test.php so einstellen
Code: [Select]
<?php
include("./gallery/random.php");
?>

Title: Re: [Mod] Random image / Zufallsbild
Post by: rubberduck on January 24, 2008, 12:06:05 PM
Wenn es ein Gast ist und der dann auf den Link klicken würde, dann würde er doch auf die index.php umgeleitet, oder ? Also könnte man ja grundsätzlich alle Bilder anzeigen lassen.

Wenn ich

Code: [Select]
define('ROOT_PATH', './');
in die random.php schreibe dann kommt der Fehler das er ./config.php nicht finden kann, obwohl die random.php ja im Hauptverzeichnis der Gallerie liegt, also da wo auch die config.php ist.

Trage ich

Code: [Select]
define('ROOT_PATH', './gallery/');
ein, dann geht es.

Title: Re: [Mod] Random image / Zufallsbild
Post by: mawenzi on January 24, 2008, 12:18:02 PM
@rubberduck
... wenn deine Galerie tiefer im Verzeichnis liegt, dann ist das natürlich bei der 'SCRIPT_URL' zu berücksichtigen ...
Code: [Select]
define('SCRIPT_URL', 'http://www.reptilienmanager.de/gallery/');
... 'ROOT_PATH' bleibt dann wie bereits angegeben ... (siehe auch Nicky)
Title: Re: [Mod] Random image / Zufallsbild
Post by: rubberduck on January 24, 2008, 12:21:18 PM
@rubberduck
... wenn deine Galerie tiefer im Verzeichnis liegt, dann ist das natürlich bei der 'SCRIPT_URL' zu berücksichtigen ...
Code: [Select]
define('SCRIPT_URL', 'http://www.reptilienmanager.de/gallery/');
... 'ROOT_PATH' bleibt dann wie bereits angegeben ... (siehe auch Nicky)

Wo soll das denn rein? In die random.php? Wie gesagt ich hab die originale aus dem 1. Posting und da ist das nicht mit drin.

Title: Re: [Mod] Random image / Zufallsbild
Post by: rubberduck on January 24, 2008, 12:24:31 PM
Wenn ich das

Code: [Select]
AND c.auth_viewimage = '".AUTH_ALL."'
aus der Abfrage rausnehme wird bei Klick auf das Bild nach

Quote
http://www.reptilienmanager.de/gallery/test.php

umgeleitet. Sollte doch aber eigentlich dann die index.php der Gallery sein, oder?

Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on January 24, 2008, 12:28:19 PM
Wenn es ein Gast ist und der dann auf den Link klicken würde, dann würde er doch auf die index.php umgeleitet, oder ? Also könnte man ja grundsätzlich alle Bilder anzeigen lassen.
kann man :)

Wenn ich

Code: [Select]
define('ROOT_PATH', './');
in die random.php schreibe dann kommt der Fehler das er ./config.php nicht finden kann, obwohl die random.php ja im Hauptverzeichnis der Gallerie liegt, also da wo auch die config.php ist.

Trage ich

Code: [Select]
define('ROOT_PATH', './gallery/');
ein, dann geht es.

jau habs auch gerade mitbekommen..
na jut die random.php wird sowieso nicht aufgerufen :)
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on January 24, 2008, 12:30:16 PM
Wenn ich das

Code: [Select]
AND c.auth_viewimage = '".AUTH_ALL."'
aus der Abfrage rausnehme wird bei Klick auf das Bild nach

Quote
http://www.reptilienmanager.de/gallery/test.php

umgeleitet. Sollte doch aber eigentlich dann die index.php der Gallery sein, oder?

poste deine random.php
Title: Re: [Mod] Random image / Zufallsbild
Post by: rubberduck on January 24, 2008, 12:32:35 PM
Hier ist sie. Hab die (c) Vermerke mal entfernt fürs Posting.

Code: [Select]
<?php
// 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)) ? 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."
        "
;
$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."
        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";
?>


Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on January 24, 2008, 02:45:35 PM
hmm..

also jetzt muss ich aufgeben.. weiss jetzt nicht genau warum es auf diese seite geleitet wird.
sorry daweil
Title: Re: [Mod] Random image / Zufallsbild
Post by: rubberduck on January 24, 2008, 03:04:09 PM
Kein Problem, ich muss da sowieso noch was ändern, dann kann ich das auch gleich so umbauen das es von der Hauptseite aus die DB direkt ausliesst und mit den direkten URLs arbeiten.

Trotzdem vielen Dank für Deine Mühe.

Title: Re: [Mod] Random image / Zufallsbild
Post by: rubberduck on January 24, 2008, 04:19:32 PM
Also ich kann manchen was ich will, ich bekomme diese komische Umleitung nicht weg. Scheint so als wenn es was mit der details.php zu tun hat.

Hat evtl. jemand noch eine Idee?

Title: Re: [Mod] Random image / Zufallsbild
Post by: nobby on January 24, 2008, 04:22:33 PM
Leere mal den Cache.
Title: Re: [Mod] Random image / Zufallsbild
Post by: rubberduck on January 24, 2008, 04:27:20 PM
Leere mal den Cache.

Alles schon gemacht. Habs auch schon über einen anderen Rechner probiert :( Der hängt dann sogar noch ne Session ID dran :)

http://www.reptilienmanager.de/test.php

Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on January 24, 2008, 05:51:20 PM
die einfachste variante:
die test.php in gallery verzeichnis erstellen mit redirect zur index.php :mrgreen:
Title: Re: [Mod] Random image / Zufallsbild
Post by: rubberduck on January 24, 2008, 11:03:09 PM
Habs jetzt so gemacht, das wenn auth_viewimage = 0 ist, dann wird der Link mit eingebunden, ansonsten nur das Bild.

Zusätzlich wird die Kategorie mit verlinkt und die anderen Daten wie z.B. Views/Downloads/Stimmen werden auch noch mit angezeigt.

Title: Re: [Mod] Random image / Zufallsbild
Post by: gb75 on March 06, 2008, 04:42:35 PM
All in German, perphas have it answer to my question, bit I don't speak Grerman.

I try random.php (1st page post), but isn't work.

I want take random image (like index.php) from my galleries, and put it in my portal index. I use mxbb2, and isn't problem for include random.php to my portal page.

Can you help me please.


ok I find it here http://www.4homepages.de/forum/index.php?topic=1020.msg109998#msg109998

but confusion

An unexpected error occured. Please try again later.

An unexpected error occured. Please try again later.

non display image -> albums/thumbs//

Comments:

-- ok --

I insert random.php with iframe is ok
Title: Re: [Mod] Random image / Zufallsbild
Post by: squalls_dreams on March 15, 2008, 08:16:14 PM
alright I dont wanna read through all these posts so I'm gonna ask. I put this code on my site and all that shows up is a blank image. heres the url to my site, http://www.ffbte.net


Title: Re: [Mod] Random image / Zufallsbild
Post by: KurtW on March 16, 2008, 07:40:23 AM
Hi,

put the random.php in the main folder from 4images.

 :!: And rebuild the copyright text on your page:
http://www.ffbte.net/ffgallery/
Your changes are not allowed :!:


KurtW
Title: Re: [Mod] Random image / Zufallsbild
Post by: squalls_dreams on March 16, 2008, 06:40:56 PM
alright, thanks 8)

alright it works..

I just copy and pasted a code that someone else posted up on the page before this one.
Title: Re: [Mod] Random image / Zufallsbild
Post by: spanky on April 13, 2008, 06:20:58 PM
I have uploaded the random.php into my gallery directory. I get a blank page. Any ideas?
Title: Re: [Mod] Random image / Zufallsbild
Post by: Spanien-Portal on April 17, 2008, 07:28:11 PM
Hallo All,

ich habe die random.php eingebuat, mit der Erweiterung, dass angezeigte Bilder bei anklicken im neuen Fenster öffnen.
Soweit, so gut.

Nun habe ich noch ein paar Fragen:

1. Wie kann ich die Schriftgrösse verändern? (zum Beispiel: Bildname und Comments = in kleinerer Schrift anzeigen)

2. Wie kann ich das angezeigte Bild proportional verkleinert anzeigen lassen, da ich es in meiner Homepage anzeigen möchte, wo allerdings nur 90% des Bildes Platz hätten?

3. Gibt es eine Möglichkeit, dass ich verschiedene Kategorien NICHT anzeigen lasse?

Dank im Voraus an alle "Tüftler" und solche, die mir vielleicht helfen können.

Sonja
.
Title: Re: [Mod] Random image / Zufallsbild
Post by: honda2000 on April 17, 2008, 08:08:13 PM
2. ControlPanel > Bilder verwalten > Auto-Image-Resizer Bilder proportional verkleinern
1. style.css in den jeweilgen zeilen, Tabellen font-size: xxxpx; einfügen
oder im jeweilgen Template <font-size="xxx"> </font> besser wäre style="font-size: xxxpx;"
3. ControlPanel Kategorien bearbeiten: wer darf was? z.B. sehen nur Administartoren oder ....

werd ich jetzt zum Clubbesuch eingeladen? :wink: :lol:
Title: Re: [Mod] Random image / Zufallsbild
Post by: Spanien-Portal on April 17, 2008, 09:17:34 PM
@ honda2000

Herzlichen Dank für die prompte Antwort.
Siehste, ich bin doch schusselig blond :-(

auf die Einstellungen per css hätte ich auch selbst kommen können...

Nur ... ich möchte ja die Thumbs proportional verkleinern und NICHT die Thumbs in der Original-Plattform verändern!

Das gleiche gilt bei den angezeigten Thumbs im externen Web. Dort sollen gewisse Kategorien NICHT angezeigt werden, aber den Usern in der Original-Plattform soll der Zugang zu allen Bereichen (nach Möglichkeit) ohne Registrierung möglich sein.

Puuuuh... das war hoffentlich verständlich geschrieben ???

*grins* zum Thema Clubbesuch... ist leider etwas weit von hier aus (Costa del Sol) ... hi hi, sonst, "Warum nicht?" *lach*

Sonnige Grüße an alle hier, Sonja
.
Title: Re: [Mod] Random image / Zufallsbild
Post by: nfdieter on June 05, 2008, 07:18:22 PM
Moin Nicki,

hab jetzt die random.php integriert mit Iframe und als Beispiel 4 Thumbs...
Ist es möglich, die Thumbs horizontal statt vertikal anzuzeigen?

Weil das sieht echt ein wenig doof aus :roll:
http://emmelsbuell.net/cms/html/modules.php?name=Content&pid=2

Gruß Dieter
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on June 05, 2008, 10:02:33 PM
wenn du name und comments ausgelassen hast ist es einfach

ändere
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";
auf
Code: [Select]
echo "<a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a>&nbsp;\n";
Title: Re: [Mod] Random image / Zufallsbild
Post by: nfdieter on June 06, 2008, 07:17:42 PM
Danke Nicky,

klappt  :D

Gruß Dieter
Title: Re: [Mod] Random image / Zufallsbild
Post by: *handsome* on September 22, 2008, 07:55:13 AM
welll i want to show more than one images plz help

and how can i shopw images of specific catagory i had try this

        AND a.cat_id=4

but it is not working Sad
Title: Re: [Mod] Random image / Zufallsbild
Post by: Patrick81 on September 30, 2008, 08:35:03 AM
Hi,

thanks for this great mod!

I would like to ask you, if its possible to add an "slideshow" feature with fade-in - fade-out effect for new pictures everyl ~30 minute?

Thanks!
Pat

this is my script without slideshow and fade-in/fade-out:
Quote
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: random_full.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
define('ROOT_PATH', '../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_media_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'];
$full_src = (is_remote($row['image_media_file'])) ? $row['image_media_file'] : ROOT_PATH.MEDIA_DIR."/".$cat_id."/".$row['image_media_file'];

$bgcolor1 = "#e5e5e5";
$bgcolor2 = "#e5e5e5";
$bgcolor3 = "#e5e5e5";
$bgcolor4 = "#e5e5e5";
$textcolor1 = "#000000";
$textcolor2 = "#000000";

//echo "<body bgcolor=\"#e5e5e5\" text=\"#000000\"
//echo "<style="background-color:#e5e5e5">
echo "<body bgcolor=\"#e5e5e5\"><a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$full_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
?>
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on September 30, 2008, 08:53:25 AM
welll i want to show more than one images plz help

and how can i shopw images of specific catagory i had try this

        AND a.cat_id=4

but it is not working Sad

*handsome* use this:
Code: [Select]
<?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)) ? 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."
        AND a.cat_id = 4
        ORDER BY RAND() 
        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=\"0\" alt=\"$image_name\"></a><br>\n";
  echo 
"<b>$image_name</b><br>\n";
  echo 
"Comments: $image_comments<hr>\n";
}
?>
Title: Re: [Mod] Random image / Zufallsbild
Post by: *handsome* on October 08, 2008, 07:34:05 AM
welll i want to show more than one images plz help

and how can i shopw images of specific catagory i had try this

        AND a.cat_id=4

but it is not working Sad

*handsome* use this:
Code: [Select]
<?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)) ? 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."
        AND a.cat_id = 4
        ORDER BY RAND() 
        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=\"0\" alt=\"$image_name\"></a><br>\n";
  echo 
"<b>$image_name</b><br>\n";
  echo 
"Comments: $image_comments<hr>\n";
}
?>


thanks for help..

but is it possible to open image in new window... forexample when visitor click on random image its open in new window

i try to add blank tag but it is not working (givving some errors
Title: Re: [Mod] Random image / Zufallsbild
Post by: KurtW on October 08, 2008, 07:14:40 PM
Hi*handsome*,

use this:

Code: [Select]
echo "<a href=\"".ROOT_PATH."details.php?image_id=$image_id\" target=\"_blank\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br />\n";or
Code: [Select]
echo "<a href=\"".ROOT_PATH."details.php?image_id=$image_id\" onclick=\"opendetailwindow()\" target=\"detailwindow\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br />\n";

Kurt
Title: Re: [Mod] Random image / Zufallsbild
Post by: External on October 24, 2008, 05:37:52 PM
Hi,

I want to publish random picture on my server www.stacho.cz

The gallery is located at gallery.rammstein-europe.com

I get this error:

Code: [Select]
Warning: include() [function.include]: URL file-access is disabled in the server configuration in /pub/stachowa/stacho.cz/web/test/random.php on line 30

Warning: include(http://gallery.rammstein-europe.com/config.php) [function.include]: failed to open stream: no suitable wrapper could be found in /pub/stachowa/stacho.cz/web/test/random.php on line 30

Warning: include() [function.include]: Failed opening 'http://gallery.rammstein-europe.com/config.php' for inclusion (include_path='.:/usr/local/lib/php:/pub/stachowa/stacho.cz/include') in /pub/stachowa/stacho.cz/web/test/random.php on line 30

Warning: include() [function.include]: URL file-access is disabled in the server configuration in /pub/stachowa/stacho.cz/web/test/random.php on line 31

Warning: include(http://gallery.rammstein-europe.com/includes/db_mysql.php) [function.include]: failed to open stream: no suitable wrapper could be found in /pub/stachowa/stacho.cz/web/test/random.php on line 31

Warning: include() [function.include]: Failed opening 'http://gallery.rammstein-europe.com/includes/db_mysql.php' for inclusion (include_path='.:/usr/local/lib/php:/pub/stachowa/stacho.cz/include') in /pub/stachowa/stacho.cz/web/test/random.php on line 31

Warning: include() [function.include]: URL file-access is disabled in the server configuration in /pub/stachowa/stacho.cz/web/test/random.php on line 32

Warning: include(http://gallery.rammstein-europe.com/includes/constants.php) [function.include]: failed to open stream: no suitable wrapper could be found in /pub/stachowa/stacho.cz/web/test/random.php on line 32

Warning: include() [function.include]: Failed opening 'http://gallery.rammstein-europe.com/includes/constants.php' for inclusion (include_path='.:/usr/local/lib/php:/pub/stachowa/stacho.cz/include') in /pub/stachowa/stacho.cz/web/test/random.php on line 32

Fatal error: Class 'Db' not found in /pub/stachowa/stacho.cz/web/test/random.php on line 35

What I did was that i edited only one line in the php file you provide, it looks now like this:

Code: [Select]
define('ROOT_PATH', 'http://gallery.rammstein-europe.com/');

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_media_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'];
$full_src = (is_remote($row['image_media_file'])) ? $row['image_media_file'] : ROOT_PATH.MEDIA_DIR."/".$cat_id."/".$row['image_media_file'];

echo "<a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$full_src."\" border=\"1\" alt=\"$image_name\"></a><br>\n";
?>

Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on October 24, 2008, 08:31:27 PM
Hello and welcome to 4images forum.

You cannot use full internet path in ROOT_PATH. This script must be on the same server as 4images.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Jan-Lukas on October 24, 2008, 08:41:22 PM
versuche mal dieses

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


Harald
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on October 24, 2008, 09:51:57 PM
Hi External and welcome to the 4images forum

try it so:
random.php (place it there where your 4images config.php is)
define('ROOT_PATH', './');
define('SCRIPT_URL', 'http://gallery.rammstein-europe.com/');

instead off:
echo "<a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$full_src."\" border=\"1\" alt=\"$image_name\"></a><br>\n";

use this

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


on www.stacho.cz try to add this into your html
Code: [Select]
<SCRIPT language='JavaScript'  src='http://gallery.rammstein-europe.com/random.php'></SCRIPT>
hope this will work for you
Title: Re: [Mod] Random image / Zufallsbild
Post by: External on October 25, 2008, 12:36:27 PM
Hi Nicky,

I used the code you provided but it is not working yet. Here is the code:

random.php uploaded to root in gallery.rammstein-europe.com:

Code: [Select]
define('ROOT_PATH', './');
define('SCRIPT_URL', 'http://gallery.rammstein-europe.com/');
include(ROOT.'/config.php');
include(ROOT.'/includes/db_mysql.php');
include(ROOT.'/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_media_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'];
$full_src = (is_remote($row['image_media_file'])) ? $row['image_media_file'] : ROOT_PATH.MEDIA_DIR."/".$cat_id."/".$row['image_media_file'];

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

and this index.htm file in test.stacho.cz:

Code: [Select]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=windows-1250">
  <meta name="generator" content="PSPad editor, www.pspad.com">
  <title></title>
  </head>
  <body>
LOL

<SCRIPT language='JavaScript'  src='http://gallery.rammstein-europe.com/random.php'></SCRIPT>
  </body>
</html>

As you can see, test.stacho.cz doesn't show any images.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Jan-Lukas on October 25, 2008, 05:11:10 PM
hab es mal bei mir als Iframe eingebunden, da kommt diese Fehlermeldung


Warning: include(ROOT/config.php) [function.include]: failed to open stream: No such file or directory in /pub/stachowa/rammstein-europe.com/web/gallery/random.php on line 30

Warning: include() [function.include]: Failed opening 'ROOT/config.php' for inclusion (include_path='.:/usr/local/lib/php:/pub/stachowa/rammstein-europe.com/include') in /pub/stachowa/rammstein-europe.com/web/gallery/random.php on line 30

Warning: include(ROOT/includes/db_mysql.php) [function.include]: failed to open stream: No such file or directory in /pub/stachowa/rammstein-europe.com/web/gallery/random.php on line 31

Warning: include() [function.include]: Failed opening 'ROOT/includes/db_mysql.php' for inclusion (include_path='.:/usr/local/lib/php:/pub/stachowa/rammstein-europe.com/include') in /pub/stachowa/rammstein-europe.com/web/gallery/random.php on line 31

Warning: include(ROOT/includes/constants.php) [function.include]: failed to open stream: No such file or directory in /pub/stachowa/rammstein-europe.com/web/gallery/random.php on line 32

Warning: include() [function.include]: Failed opening 'ROOT/includes/constants.php' for inclusion (include_path='.:/usr/local/lib/php:/pub/stachowa/rammstein-europe.com/include') in /pub/stachowa/rammstein-europe.com/web/gallery/random.php on line 32

Fatal error: Class 'Db' not found in /pub/stachowa/rammstein-europe.com/web/gallery/random.php on line 35



Bin jetzt nicht der Profi, aber kann es sein, das man bei deinem Hoster, nicht von ausserhalb auf die DB zugreifen kann ??
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on October 25, 2008, 06:32:52 PM
hi all..
http://www.siteshot.at/nicky.htm

your examples can't work.. if you don' use correct code like descriped in the MOD file..

ROOT != ROOT_PATH  :roll:  :lol: :P 8)

use EXACT following code:


<?php
define('ROOT_PATH', './');
define('SCRIPT_URL', 'http://gallery.rammstein-europe.com/');
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_media_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'];
$full_src = (is_remote($row['image_media_file'])) ? $row['image_media_file'] : SCRIPT_URL.ROOT_PATH.MEDIA_DIR."/".$cat_id."/".$row['image_media_file'];

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


Code: [Select]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=windows-1250">
  <meta name="generator" content="PSPad editor, www.pspad.com">
  <title></title>
  </head>
  <body>
LOL

<SCRIPT language='JavaScript'  src='http://gallery.rammstein-europe.com/random.php'></SCRIPT>
  </body>
</html>

[EDIT by V@no]
corrected index.html to avoid confusion ;) their original code was correct.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Jan-Lukas on October 25, 2008, 07:55:18 PM
Und auch hier heisst es immer "Augen auf beim coden"  :mrgreen:
ist mir auch nicht aufgefallen, aber bin ja auch kein Profi

LG Harald
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on October 25, 2008, 10:16:16 PM
Quote
[EDIT by V@no]
corrected index.html to avoid confusion ;) their original code was correct.

oha :)
i think i forgot my site inside.
thank you V@no!

Harald,
kein problem.. ich habs auch zufällig gesehen... ;)
Title: Re: [Mod] Random image / Zufallsbild
Post by: External on October 26, 2008, 12:00:42 AM
Thank you very much, I was little bit blind.

One more question...instead of resizing random generated picture by width and height attribute, is it possible to generate random thumbnail instead of full image?

That would safe a lot of traffic (gigabites per day)
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on October 26, 2008, 12:13:17 AM
replace image_media_file with image_thumb_file
Title: Re: [Mod] Random image / Zufallsbild
Post by: External on October 26, 2008, 12:22:42 AM
I replaced it on 4 places in the code, it looks now like this:
Code: [Select]
<?php
define
('ROOT_PATH''./');
define('SCRIPT_URL''http://gallery.rammstein-europe.com/');
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)) ? 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'];
$full_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : SCRIPT_URL.ROOT_PATH.MEDIA_DIR."/".$cat_id."/".$row['image_thumb_file'];

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


But somohow it is still displaying original size pictures. Any ideas?
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on October 26, 2008, 12:37:24 AM
ops..forgot one more change...
replace MEDIA_DIR with THUMB_DIR
but I must warn you, if image doesn't have thumbnail, it'll show a broken image.
Title: Re: [Mod] Random image / Zufallsbild
Post by: External on October 26, 2008, 12:46:54 AM
Now it is working just excellent. Thanx a lot people!
Title: Re: [Mod] Random image / Zufallsbild
Post by: External on October 26, 2008, 01:20:20 AM
OK, the very last thing (I hope :wink: ) is what to do if I want to display 3 images instead of one?

I mean 3 different images. I tried some modification by myself but it was not working
Title: Re: [Mod] Random image / Zufallsbild
Post by: V@no on October 26, 2008, 01:24:03 AM
use in your index.html:
Code: [Select]
<SCRIPT language='JavaScript'  src='http://gallery.rammstein-europe.com/random.php?1'></SCRIPT>
<SCRIPT language='JavaScript'  src='http://gallery.rammstein-europe.com/random.php?2'></SCRIPT>
<SCRIPT language='JavaScript'  src='http://gallery.rammstein-europe.com/random.php?3'></SCRIPT>
note, ?1 ?2 and ?3 is just any numbers or strings to prevent browser from caching these scripts.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Relax2012 on October 28, 2008, 01:09:33 PM
Hallo,

gibt es hier in diesem Script die Möglichkeit, dass man nur die Zufallsbilder angezeigt bekommt, die im Querformat aufgenommen wurden? Demnach müssten über einen Filter alle Bilder im Hochformat ausgefiltert werden.

Bei der Anordnung der Zufallsbilder auf meiner Startseite der Homepage www.keylight-pictures.com sieht es sonst ziemlich blöd aus...   :(

Da die Abmessungen der Bilder im System vorhanden sind, müsste es doch eigentlich möglich sein, den Wert der Bildhöhe bzw. Bildbreite zu verarbeiten. Da ich mich aber mit php nicht auskenne, weiss ich auch nicht, wie man dies machen kann?  :?

Würde mich über einen Ratschlag riesig freuen.

-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------

Vermutlich ist das doch ein grösseres Problem - deswegen habe ich eine andere Lösung ausprobiert.

-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------


Viele Grüße
Klaus
Title: Re: [Mod] Random image / Zufallsbild
Post by: nhomauhoaphuong on November 12, 2008, 08:48:42 PM
okie i've read many post but i still can't make it work. please help me here.

my random.php file

Code: [Select]
<?php
define
('ROOT_PATH''./hinhanh/');
define('SCRIPT_URL''http://www.domainame.com/hinhanh/');
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)) ? 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'];
$full_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : SCRIPT_URL.ROOT_PATH.MEDIA_DIR."/".$cat_id."/".$row['image_thumb_file'];

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


and this is my test.html file that will be intergrated into my main index.php page... here is the code i put in there..

Code: [Select]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=windows-1250">
  <meta name="generator" content="PSPad editor, www.pspad.com">
  <title></title>
  </head>
  <body>
LOL
<SCRIPT language='JavaScript'  src='http://domainame.com/hinhanh/random.php?1'></SCRIPT>
<SCRIPT language='JavaScript'  src='http://domainame.com/hinhanh/random.php?2'></SCRIPT>
<SCRIPT language='JavaScript'  src='http://domainame.com/hinhanh/random.php?3'></SCRIPT>[/quote]

  </body>
</html>

but then i still can't make it works.
it still showing this error

it only show the word LOL when i view the test.html file... wont show those 3 images
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on November 12, 2008, 08:57:01 PM


change
Code: [Select]
define('ROOT_PATH', './hinhanh/');to
Code: [Select]
define('ROOT_PATH', './');
and place the random.php where your 4images config.php is.. then it will work..
Title: Re: [Mod] Random image / Zufallsbild
Post by: nhomauhoaphuong on November 12, 2008, 09:02:59 PM
i did - my 4images dir is in ./hinhanh, the config.php is in that root too... i already take off the ./hinhanh/ now only define('ROOT_PATH', './');
but still not working ... i view the random.php file and it's shown these error.
Quote
Warning: include(ROOT/config.php) [function.include]: failed to open stream: No such file or directory in /home1/chuahuon/public_html/hinhanh/random.php on line 29

Warning: include() [function.include]: Failed opening 'ROOT/config.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home1/chuahuon/public_html/hinhanh/random.php on line 29

Warning: include(ROOT/includes/db_mysql.php) [function.include]: failed to open stream: No such file or directory in /home1/chuahuon/public_html/hinhanh/random.php on line 30

Warning: include() [function.include]: Failed opening 'ROOT/includes/db_mysql.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home1/chuahuon/public_html/hinhanh/random.php on line 30

Warning: include(ROOT/includes/constants.php) [function.include]: failed to open stream: No such file or directory in /home1/chuahuon/public_html/hinhanh/random.php on line 31

Warning: include() [function.include]: Failed opening 'ROOT/includes/constants.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home1/chuahuon/public_html/hinhanh/random.php on line 31

Fatal error: Class 'Db' not found in /home1/chuahuon/public_html/hinhanh/random.php on line 34
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on November 12, 2008, 09:04:04 PM
Hallo,

gibt es hier in diesem Script die Möglichkeit, dass man nur die Zufallsbilder angezeigt bekommt, die im Querformat aufgenommen wurden? Demnach müssten über einen Filter alle Bilder im Hochformat ausgefiltert werden.

Bei der Anordnung der Zufallsbilder auf meiner Startseite der Homepage www.keylight-pictures.com sieht es sonst ziemlich blöd aus...   :(

Da die Abmessungen der Bilder im System vorhanden sind, müsste es doch eigentlich möglich sein, den Wert der Bildhöhe bzw. Bildbreite zu verarbeiten. Da ich mich aber mit php nicht auskenne, weiss ich auch nicht, wie man dies machen kann?  :?

Würde mich über einen Ratschlag riesig freuen.

-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------

Vermutlich ist das doch ein grösseres Problem - deswegen habe ich eine andere Lösung ausprobiert.

-----------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------


Viele Grüße
Klaus


hi & sorry, hab diesen post übersehen...
wenn die abmessung in deiner mysql DB drinnen sind, was normalerweise nicht der fall ist, dann ist es ja kein problem :)
wenn doch nicht.. dann wird das wohl nichts..
ausser jemand schreibt ein script der die bilder abmessungen in die datenbank reinbekommt.. danach, ist es kein problem mehr :)
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on November 12, 2008, 09:06:40 PM
are you sure that you have this inside
Code: [Select]
define('ROOT_PATH', './');
define('SCRIPT_URL', 'http://www.domainame.com/hinhanh/');
include(ROOT_PATH.'config.php');
include(ROOT_PATH.'includes/db_mysql.php');
include(ROOT_PATH.'includes/constants.php');
?

and not

Code: [Select]
define('ROOT', './');
define('SCRIPT_URL', 'http://www.domainame.com/hinhanh/');
include(ROOT.'config.php');
include(ROOT.'includes/db_mysql.php');
include(ROOT.'includes/constants.php');
Title: Re: [Mod] Random image / Zufallsbild
Post by: nhomauhoaphuong on November 13, 2008, 02:46:42 AM
i got it. thanks alot.

but then i put this code into my index.php on main main page...
Quote
. "<SCRIPT language='JavaScript'  src='http://domainname.com/hinhanh/random.php?1' border='0' width='73' height='83'></SCRIPT>"
. "<SCRIPT language='JavaScript'  src='http://domainname.com/hinhanh/random.php?2' border='0' width='73' height='83'></SCRIPT>"
. "<SCRIPT language='JavaScript'  src='http://domainname.com/hinhanh/random.php?3' border='0' width='73' height='83'></SCRIPT>"
. "<SCRIPT language='JavaScript'  src='http://domainname.com/hinhanh/random.php?4' border='0' width='73' height='83'></SCRIPT>"
. "<SCRIPT language='JavaScript'  src='http://domainname.com/hinhanh/random.php?5' border='0' width='73' height='83'></SCRIPT>"
. "<SCRIPT language='JavaScript'  src='http://domainname.com/hinhanh/random.php?6' border='0' width='73' height='83'></SCRIPT>"
. "<SCRIPT language='JavaScript'  src='http://domainname.com/hinhanh/random.php?7' border='0' width='73' height='83'></SCRIPT>"

i got this and it's working now... but i seted the size of these images to be the same size.. like that ... but how come when it's shown it's not the same size.. so how do i make them all to be shown in one size.
please help.
thanks
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on November 13, 2008, 07:49:53 AM
morning,

1st at all.
get back our 4images copyright into your templates.  :evil:
you know what i mean... clickable link to 4homepages.de below "Powered by 4images 1.7.6" ;)
THANK YOU!

2nd:
don't use width and height in your example.
edit your random.php to following:
Code: [Select]
document.write('<a href=\"".SCRIPT_URL."details.php?image_id=$image_id\"><img src=\"".$full_src."\" border=\"0\" width=\"73\" height=\"83\" alt=\"$image_name\"></a>');
Title: Re: [Mod] Random image / Zufallsbild
Post by: nhomauhoaphuong on November 15, 2008, 07:05:40 PM
let say i want to make this random image switches every 3 seconds, make it like flash.. how do you do this.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Dipi on November 21, 2008, 01:15:47 PM

Ich habe da mal eine Frage. Was muss ich wo verändern, damit das Vorschaubild aus der Galerie auf meiner HP größer wird? Wo kann ich die Werte verändern?

Link zur HP:

http://www.german-spotter-network.de/ (http://www.german-spotter-network.de/)

Viele Grüße

Dipi
Title: Re: [Mod] Random image / Zufallsbild
Post by: mawenzi on November 21, 2008, 01:40:10 PM
... das Vorschaubild ist halt so groß wie deine Thumbnails in deiner Galerie ...
... du müsstest also die Thumbnail-Größe in deiner Galerie ändern ... via ACP ...
... denn das Vorschaubild größer zerren als es ist ... macht wohl keinen Sinn ... ;)
Title: Re: [Mod] Random image / Zufallsbild
Post by: Dipi on November 21, 2008, 01:50:25 PM

Wenn das jetzt wirklich so einfach ist..... ich probier das gleich mal aus.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Dipi on November 21, 2008, 02:11:35 PM

Sauber, hat geklappt. Gibt es im ACP eine Funktion mit der ich alle bisher (zu kleinen) Thumbs löschen kann?
Title: Re: [Mod] Random image / Zufallsbild
Post by: mawenzi on November 21, 2008, 02:19:53 PM
... eine Löschfunktion für die Thumbs im ACP gibt es nur über die Bild-bearbeiten-Seite ...
... sollte dir das zu mühselig sein, dann via FTP ... /data/media/thumbnails/ ... in den einzelnen Nr.-Ordnern die Thumbnails löschen ...
... und dann via ACP -> Auto-Thumbnailer die neuen, größeren Thumbnails erzeugen ...

... soweit zur Theorie ... und jetzt bist du dran ... ;)
Title: Re: [Mod] Random image / Zufallsbild
Post by: Dipi on November 21, 2008, 02:57:30 PM
... eine Löschfunktion für die Thumbs im ACP gibt es nur über die Bild-bearbeiten-Seite ...
... sollte dir das zu mühselig sein, dann via FTP ... /data/media/thumbnails/ ... in den einzelnen Nr.-Ordnern die Thumbnails löschen ...
... und dann via ACP -> Auto-Thumbnailer die neuen, größeren Thumbnails erzeugen ...

... soweit zur Theorie ... und jetzt bist du dran ... ;)

Auch das habe ich geschafft. Jetzt sieht das auf jeden Fall viel besser aus. Danke für deine Hilfe!

Gruss

Dipi
Title: Re: [Mod] Random image / Zufallsbild
Post by: mawenzi on November 21, 2008, 03:13:25 PM
... tatsächlich ... die Thumbs sind alle größer ... ;)
... nun solltest du aber noch dein Galerie-Template anpassen ...
... so dass die großen Thumbs dir nicht das Layout sprengen ...
Title: Re: [Mod] Random image / Zufallsbild
Post by: honda2000 on December 04, 2008, 06:23:20 PM
hi, ich hab auch ne Frage zum Random:

random.php
Zeile 66

Code: [Select]
echo "<a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img
src=\"".$thumb_src."\" border=\"1\" alt=\"$image_name\"></a><br>\n";

jetzt liegt aber die Galerie in einem Frame mit .htaccess,
siehe:
http://www.4homepages.de/forum/index.php?topic=19882.0
letzte Antwort

wie aber, bekomm eich es hin, das bei www.suppenlaender.de

rechts beim Random-Image, die Galerie innerhalb des Frames öffnet, oben in der reinen Navi, Fotogalerie, klappts ja auch
 

Title: Re: [Mod] Random image / Zufallsbild
Post by: Daniel on December 04, 2008, 06:48:56 PM
denke mal das nur der header fehlt...
Title: Re: [Mod] Random image / Zufallsbild
Post by: honda2000 on December 04, 2008, 07:28:03 PM
???
dann würde ja: http://www.suppenlaender.de/fotogalerie/index.php
nicht funktionieren, klar ist der header da!
guckste: http://www.suppenlaender.de/galerie/index.php

der Inhalt wird per .htaccess geladen, somit siehtst du im Quelltext keinen Frame oder iFrame
Title: Re: [Mod] Random image / Zufallsbild
Post by: Oldie on December 22, 2008, 05:35:02 PM
Hi everybody


I use Version 1.7.6! I need help with the indication of  rondom pictures on an external site! I don´t understand a lot php! I read almost all about the rondom picture in this forum in ahead! But..... :roll:

I want 3 rondom pictures underneath on www.oldtimers-im-fokus.ch

I saved the script mentioned on   http://www.nicky.net/4images/random.txt under rondom.php
During the instructions, they talk about a file called rondom_mod.php ......................I cannot find any file like this??

And in what root to I have to save rondom.php ?? In the 4image gallery level, or in the root level of the page where I want the rondom image to show up?

Thanks a lot


Oldie

Title: Re: [Mod] Random image / Zufallsbild
Post by: *handsome* on December 25, 2008, 09:13:21 AM
well when i show more than 1 image like 5 it show from up to down is it possible that it show images from left to right or right to left?
Title: Re: [Mod] Random image / Zufallsbild
Post by: Blesi on December 25, 2008, 03:11:40 PM
Ist es möglich ein Zufallsbild von nur EINER Kategorie zu erzeugen? So, dass ich auf einer externen Seite 5 Zufallsbilder habe von 5 bestimmten Kategorien?

Is it possible a random-image from ONE categorie to create? So that i have at an external page five random-pictures from five defined categories?

Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on December 25, 2008, 03:29:40 PM
Hi everybody


I use Version 1.7.6! I need help with the indication of  rondom pictures on an external site! I don´t understand a lot php! I read almost all about the rondom picture in this forum in ahead! But..... :roll:

I want 3 rondom pictures underneath on www.oldtimers-im-fokus.ch

I saved the script mentioned on   http://www.nicky.net/4images/random.txt under rondom.php
During the instructions, they talk about a file called rondom_mod.php ......................I cannot find any file like this??

And in what root to I have to save rondom.php ?? In the 4image gallery level, or in the root level of the page where I want the rondom image to show up?

Thanks a lot


Oldie



hi,

create a blank file with the name, as example for the test, random_mod.php (normaly you can add the below to your php script)
Code: [Select]
<?php
 
include("./random.php");
?>

place random.php into the root of 4images..

BUT you have to define PATH of random.php in random_mod.php or in your php file
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on December 25, 2008, 03:31:49 PM
well when i show more than 1 image like 5 it show from up to down is it possible that it show images from left to right or right to left?

change
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";
echo "<b>$image_name</b><br>\n";
echo "Comments: $image_comments<br>\n";
to
Code: [Select]
echo "<a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a>\n";but you will not have image name and number of comments.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on December 25, 2008, 03:33:38 PM
Ist es möglich ein Zufallsbild von nur EINER Kategorie zu erzeugen? So, dass ich auf einer externen Seite 5 Zufallsbilder habe von 5 bestimmten Kategorien?

Is it possible a random-image from ONE categorie to create? So that i have at an external page five random-pictures from five defined categories?

hmm.... zuerst schreibst du von "EINER" und dann von "5 bestimmten Kategorien".
wie möchtest du es genau?
jeweils ein bild aus einer bestimmten kategorie und das ganze 5 mal so?
Title: Re: [Mod] Random image / Zufallsbild
Post by: Blesi on December 25, 2008, 10:48:38 PM
Quasi ein Zufallsbild wo mir nur Bilder einer bestimmten Kategorie anzeigt. Ich meinte dann dass ich 5 Zufallsbilder auf ne andere Seite machen kann. Aber nur von EINER bestimmten Ketegorie die ich frei wählen kann. Es sollte aber variable sein, d.h. ich mache zwei Zufallsbilder nebeneinander und das linke zeigt dann nur Fußballbilder und das rechte nur Handballbilder.
Verstanden?

Gruß Christian
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on December 26, 2008, 10:52:58 AM
Hi Christian,

nachdem ich ein lebender ausländer in österreich bin ist deutsch nicht meine muttersprache  :mrgreen:
und habs überhaupt nicht geschnallt was du vor hast..  :oops:
vielleicht versuchst du es mit bildern  8)

nichts für ungut

LG
Title: Re: [Mod] Random image / Zufallsbild
Post by: Blesi on December 26, 2008, 07:45:22 PM
-------------------------------           -------------------------------          -------------------------------           -------------------------------
-                             -           -                             -          -                             -           -                             -
-   Zufallsbild  1          -          -   Zufallsbild 2           -          -   Zufallsbild  1          -          -   Zufallsbild 2           -
-   nur                      -           -  nur                      -          -   nur                      -           -  nur                      -
-   Kategorie Fussball  -           -  Kategorie Tennis    -          -   Kategorie Tiere      -           -  Kategorie Konzert  -
-                             -           -                             -          -                             -           -                             -
-                             -           -                             -          -                             -           -                             -
-                             -           -                             -          -                             -           -                             -
-                             -           -                             -          -                             -           -                             -
-------------------------------           -------------------------------          -------------------------------           -------------------------------

So jetzt verstanden? In jedem Zufallsbild sollen nur die Bilder der bestimmten Kategorie erscheinen.

Gruß Christian
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on December 28, 2008, 03:47:11 PM
-------------------------------           -------------------------------          -------------------------------           -------------------------------
-                             -           -                             -          -                             -           -                             -
-   Zufallsbild  1          -          -   Zufallsbild 2           -          -   Zufallsbild  1          -          -   Zufallsbild 2           -
-   nur                      -           -  nur                      -          -   nur                      -           -  nur                      -
-   Kategorie Fussball  -           -  Kategorie Tennis    -          -   Kategorie Tiere      -           -  Kategorie Konzert  -
-                             -           -                             -          -                             -           -                             -
-                             -           -                             -          -                             -           -                             -
-                             -           -                             -          -                             -           -                             -
-                             -           -                             -          -                             -           -                             -
-------------------------------           -------------------------------          -------------------------------           -------------------------------

So jetzt verstanden? In jedem Zufallsbild sollen nur die Bilder der bestimmten Kategorie erscheinen.

Gruß Christian

ich hoffe ich hab es jetzt verstanden:

http://wallp.ape.rs/random.php
zufalls bilder aus 5 verschiedenen kategorien
code dafür

<?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');

$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 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."
        AND a.cat_id = 1 /* KATEGORIE ID */
        ORDER BY RAND()
        LIMIT 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'];


$sql2 = "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."
        AND a.cat_id = 478 /* KATEGORIE ID */
        ORDER BY RAND()
        LIMIT 1";
$row2 = $site_db->query_firstrow($sql2);
$image_id2 = $row2['image_id'];
$cat_id2 = $row2['cat_id'];
$image_name2 = $row2['image_name'];
$image_comments2 = $row2['image_comments'];
$thumb_src2 = (is_remote($row2['image_thumb_file'])) ? $row2['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id2."/".$row2['image_thumb_file'];

$sql3 = "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."
        AND a.cat_id = 557 /* KATEGORIE ID */
        ORDER BY RAND()
        LIMIT 1";
$row3 = $site_db->query_firstrow($sql3);
$image_id3 = $row3['image_id'];
$cat_id3 = $row3['cat_id'];
$image_name3 = $row3['image_name'];
$image_comments3 = $row3['image_comments'];
$thumb_src3 = (is_remote($row3['image_thumb_file'])) ? $row3['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id3."/".$row3['image_thumb_file'];


$sql4 = "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."
        AND a.cat_id = 248 /* KATEGORIE ID */
        ORDER BY RAND()
        LIMIT 1";
$row4 = $site_db->query_firstrow($sql4);
$image_id4 = $row4['image_id'];
$cat_id4 = $row4['cat_id'];
$image_name4 = $row4['image_name'];
$image_comments4 = $row4['image_comments'];
$thumb_src4 = (is_remote($row4['image_thumb_file'])) ? $row4['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id4."/".$row4['image_thumb_file'];

$sql5 = "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."
        AND a.cat_id = 477 /* KATEGORIE ID */
        ORDER BY RAND()
        LIMIT 1";
$row5 = $site_db->query_firstrow($sql5);
$image_id5 = $row5['image_id'];
$cat_id5 = $row5['cat_id'];
$image_name5 = $row5['image_name'];
$image_comments5 = $row5['image_comments'];
$thumb_src5 = (is_remote($row5['image_thumb_file'])) ? $row5['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id5."/".$row5['image_thumb_file'];


echo "<table border=\"1\"><tr><td><a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a></td><td><a href=\"".ROOT_PATH."details.php?image_id=$image_id2\"><img src=\"".$thumb_src2."\" border=\"0\" alt=\"$image_name2\"></a></td><td><a href=\"".ROOT_PATH."details.php?image_id=$image_id3\"><img src=\"".$thumb_src3."\" border=\"0\" alt=\"$image_name3\"></a></td><td><a href=\"".ROOT_PATH."details.php?image_id=$image_id4\"><img src=\"".$thumb_src4."\" border=\"0\" alt=\"$image_name4\"></a></td><td><a href=\"".ROOT_PATH."details.php?image_id=$image_id5\"><img src=\"".$thumb_src5."\" border=\"0\" alt=\"$image_name5\"></a></td></tr>\n";
echo "<tr><td><b>$image_name</b><br>Kommentare: $image_comments</td><td><b>$image_name2</b><br>Kommentare: $image_comments2</td><td><b>$image_name3</b><br>Kommentare: $image_comments3</td><td><b>$image_name4</b><br>Kommentare: $image_comments4</td><td><b>$image_name5</b><br>Kommentare: $image_comments5</td></tr></table>\n";
?>

suche nach
Code: [Select]
/* KATEGORIE ID */die zahlen deinen cat_id's anpassen
Title: Re: [Mod] Random image / Zufallsbild
Post by: bergblume on January 11, 2009, 03:20:22 PM
@Harry,

here is it:
http://www.nicky.net/4images/random_more_pics.txt

for certain category add this: http://www.4homepages.de/forum/viewtopic.php?p=4360#4360

hi nicky,

vielen dank für deinen hinweis wie man mehrere bilder extern anzeigen kann... so wie es aktuell ist werden 4 bilder untereinander extern angezeigt ... wie kann ich 4 bilder nebeneinander angezeigt bekommen?

gruss, bergblume
Title: Re: [Mod] Random image / Zufallsbild
Post by: bergblume on January 11, 2009, 03:55:38 PM
ok, problem solved by myself...
if anyone should need it, here is the code:

Code: [Select]

<?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');

define('SCRIPT_URL''http://www.YOUR-DOMAIN-NAME.com/');

$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)) ? 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 RAND() 
        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 
"<table border='0' width='133' bgcolor='#FFFFFF' Align=left>\n";
  echo 
"<TR>\n";
  echo 
"<TD><a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=\"_blank\"> <img src=\"".SCRIPT_URL.$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
  echo 
"</TR>\n";
  echo 
"<TR>\n";
  echo 
"<TD bgcolor='#FFFFFF'> <a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=\"_blank\"> <b>$image_name</b></a><br>\n";
  echo 
"</TR>\n";
  echo 
"<TR>\n";
  echo 
"<TD bgcolor='#FFFFFF'>Kommentare: $image_comments</TD>\n";
  echo 
"</TR>\n";
  echo 
"</table>\n";
}
?>

Title: Re: [Mod] Random image / Zufallsbild
Post by: bergblume on January 11, 2009, 08:15:52 PM
ich habe doch noch ne kurze frage:

was muss ich einstellen, damit ich
a) alle bilder ausgegeben bekomme
b) die bilder in einer tabelle  mit je 5 bildern pro zeile ausgegeben werden??
hier den code, den ich bisher verwende (zur darstellung der tabelle)
Code: [Select]
  echo "<table border='0' width='133' bgcolor='#FFFFFF' Align=left>\n";
  echo "<TR>\n";
  echo "<TD><a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=\"_blank\"> <img src=\"".SCRIPT_URL.$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
  echo "</TR>\n";
  echo "<TR>\n";
  echo "<TD bgcolor='#FFFFFF'> <a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=\"_blank\"> <b>$image_name</b></a><br>\n";
  echo "</TR>\n";
  echo "<TR>\n";
  echo "<TD bgcolor='#FFFFFF'>Kommentare: $image_comments</TD>\n";
  echo "</TR>\n";
  echo "</table>\n";
c) ich habe ein zusätzliches image field bei mir eingebaut --- z.b. image_fotostandort --- wie kann ich die bilder extern nur zu diesem thema angezeigt bekommen=?
folgendes habe ich schon probiert leider ohne erfolg:
Quote
$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_photostandort
        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."
AND a.image_photostandort = ort1
        ORDER BY RAND()
        LIMIT $num_images";
$result = $site_db->query($sql);
Title: Re: [Mod] Random image / Zufallsbild
Post by: Ninimaus on January 26, 2009, 09:31:15 PM
Also bei dem Riesenthema blickt ja niemand mehr durch

Habe jetzt per Suchfunktion versuch etwas brauchbares herauszufinden, leider nicht !

Bin mit Php überhaupt nicht Vertraut habe es nun so eingerichtet:

die random.php liegt in meinem Galerie verzeichnis habe es auf der Hauptseite per

Code: [Select]
<?php
 
include("./galerie/random.php");
?>

einbinden können - Es funktioniert


Nun zu meinem Problem :

Ich möchte es nun auf einer Unterseite einbinden Befindlich im Ordner /blog//wp-content/themes/Girl-Grafixx

Wie muss nun der korrekte Include-Befehl lauten ?
Title: Re: [Mod] Random image / Zufallsbild
Post by: bergblume on January 26, 2009, 10:04:55 PM
am sichersten (wenn du keine php-kenntnisse hast) ist, wenn du den absoluten pfad á la
Code: [Select]
<?php
 
include("http://www.dein-domain.de/galerie/random.php");
?>
eingibst. probier´s mal so...
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on January 26, 2009, 10:15:04 PM
am sichersten (wenn du keine php-kenntnisse hast) ist, wenn du den absoluten pfad á la
Code: [Select]
<?php
 
include("http://www.dein-domain.de/galerie/random.php");
?>
eingibst. probier´s mal so...

nur zur euer info
bergblume: dies ist eine URL.. kein PFAD

http://de.wikipedia.org/wiki/URL
http://de.wikipedia.org/wiki/Pfad#Dateisystem

Title: Re: [Mod] Random image / Zufallsbild
Post by: Ninimaus on January 27, 2009, 10:17:50 AM
Warning: include() [function.include]: URL file-access is disabled in the server configuration in /mnt/web7/52/08/51792108/htdocs/blog/wp-content/themes/Girl-Grafixx/sidebar.php on line 56

Schade, so wirds nicht gehen
Title: Re: [Mod] Random image / Zufallsbild
Post by: Ninimaus on January 27, 2009, 10:43:07 PM
Niemand eine Idee ?  :(
Title: Re: [Mod] Random image / Zufallsbild
Post by: Trev on January 28, 2009, 08:26:06 PM
Hi all, hope you are fine !

I downloaded the random-image mod and would like to know:

how can I set this up to show the category of the picture?

Here is my code:
Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: random_full.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
define('ROOT_PATH''./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)) ? 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_media_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'];
$full_src = (is_remote($row['image_media_file'])) ? $row['image_media_file'] : ROOT_PATH.MEDIA_DIR."/".$cat_id."/".$row['image_media_file'];

echo 
"<img src=\"".$full_src."\" height=\"125\" width=\"150\" border=\"2\" alt=\"$image_name\"></a><br>\n";
echo 
'<font size="-2" face="Arial, Helvetica, sans-serif"><br>';

echo 
"$image_name\n";

?>

Thanks a lot

Trev
Title: Re: [Mod] Random image / Zufallsbild
Post by: Ninimaus on January 29, 2009, 09:59:52 PM
Ich habe noch immer folgendes Problem:

4images läuft auf meinem Webspace im Ordner galerie , desweiteren nutze ich einen Wordpress-Blog, dieser befindet sich im Ordner Blog.

Nun möchte ich das Zufallsbild auf der Sidebar einbinden.

Der Pfad zu dieser Datei ist folgender : /blog/wp-content/themes/Girl-Grafixx/sidebar.php

Nun habe ich versucht das Script so einzubinden:

Code: [Select]
   <?php
 
include("./../../../galerie/random.php");
?>

Leider funktioniert das so nicht.

Kann mir jemand den passenden include Befehl nennen oder hat eine Problemlösung parat ?
Title: Re: [Mod] Random image / Zufallsbild
Post by: Trev on January 30, 2009, 01:01:14 PM
Hmmm,

hat keiner eine Antwort auf meine Frage (siehe oben) ???

Bidde....  :oops:

LG
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on January 30, 2009, 08:48:41 PM
Hmmm,

hat keiner eine Antwort auf meine Frage (siehe oben) ???

Bidde....  :oops:

LG


hi,

probier es so

Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: random_full.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
define('ROOT_PATH''./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)) ? 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_media_file, a.image_comments, b.cat_name
        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_name $row['cat_name'];
$image_name $row['image_name'];
$image_name $row['image_name'];
$image_comments $row['image_comments'];
$full_src = (is_remote($row['image_media_file'])) ? $row['image_media_file'] : ROOT_PATH.MEDIA_DIR."/".$cat_id."/".$row['image_media_file'];

echo 
"<img src=\"".$full_src."\" height=\"125\" width=\"150\" border=\"2\" alt=\"$image_name\"></a><br>\n";
echo 
'<font size="-2" face="Arial, Helvetica, sans-serif"><br>';

echo 
"$image_name<br/>\n";
echo 
"$cat_name\n";
?>
Title: Re: [Mod] Random image / Zufallsbild
Post by: Ninimaus on January 30, 2009, 11:15:00 PM
Niemand hat eine Ahnung wegen dem Include Befehl  :cry:
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on January 30, 2009, 11:45:48 PM
Niemand hat eine Ahnung wegen dem Include Befehl  :cry:

hi Ninimaus,

würde dir gerne helfen aber hab kein wordpress installiert.
wenn mir die zeit zulässt gucke ich die nächsten paar tage.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Ninimaus on January 30, 2009, 11:47:17 PM
Hab jetzt wie wild rumprobiert und es geschafft
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on January 31, 2009, 12:00:37 AM
na perfect ;)
lass sehen.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Trev on February 02, 2009, 08:58:37 AM
Hallo Nicky,

vielen Dank für den Kategorie Namen, dieser wird angezeigt, doch leider wird der Thumbnail nicht angezeigt!
Könntest Du mal schauen?

Dankeschön.

(Gelöst, es fehlte das
$cat_id = $row['cat_id'];)
Title: Re: [Mod] Random image / Zufallsbild
Post by: Trev on February 09, 2009, 10:29:45 AM
Hallo

ich habe anstatt die Thumbnails zu benutzen, die eigentlichen Bilder als Vorscheu genommen. Meine Bilder sind nicht sehr groß (400px breit und so 6okb)
Momentan werden die Fotos ja skaliert (150x125 oder so).
Aber ich habe ja auch breite und hohe Bilder und mit dem Randomimage Script wird ja das Bild dann verzerrt - zu breit oder zu hoch.
Wie kann ich es ändern?

Danke
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on February 09, 2009, 12:13:43 PM
hi Trev,

hmm...

du hast es doch selber so eingestellt:
Code: [Select]
echo "<img src=\"".$full_src."\" height=\"125\" width=\"150\" border=\"2\" alt=\"$image_name\"></a><br>\n";
nehme halt
Code: [Select]
height=\"125\" width=\"150\"
wieder raus.. dann hast es in der original grösse
Title: Re: [Mod] Random image / Zufallsbild
Post by: Trev on February 09, 2009, 03:39:49 PM
Hi Nicky

Ja, das weiß ich :-)
Kann ich es evtl prozentual ausgeben?

Grüße von
Trev

Hey Du magst wohl auch Basketball?
Title: Re: [Mod] Random image / Zufallsbild
Post by: nhomauhoaphuong on May 20, 2009, 01:45:20 PM
i have a problem using this random images javascript... i tried to make these thumbnails expando when mouseover while it's marquee from the right to left... will stop and expand the image to a bigger size when mouseover ... the crawler script is working but the expando is still not working... can anyone please help me with this ....

Quote
<?php
if ((!defined('NV_SYSTEM')) AND (!defined('NV_ADMIN'))) {
    Header("Location: ../index.php");
    exit;
}
$content  .= "<head>\n";
$content  .= "<style type=\"text/css\">\n";
$content  .= "img.expando{ /*sample CSS for expando images. Not required but recommended*/\n";
$content  .= "border: none;\n";
$content  .= "vertical-align: top; /*top aligns image, so mouse has less of a change of moving out of image while image is expanding*/\n";
$content  .= "}\n";
$content  .= "</style>\n";
$content  .= "</head>\n";
$content  .= "<script type=\"text/javascript\" src=\"../js/expando.js\"></script>\n";
$content  .= "<script type=\"text/javascript\" src=\"../js/crawler.js\"></script>\n";
$content  .= "<div class=\"marquee\" id=\"mycrawler2\">\n";
$content  .= "<p><p align=\"center\">&nbsp;&nbsp;&nbsp;&nbsp;<SCRIPT language=\"JavaScript\" class=\"expando\" src=\"http://chuahuongdao.org/hinhanh/random.php?1\" width=\"140\" height=\"110\"></SCRIPT>\n";
$content  .= "&nbsp;<SCRIPT language=\"JavaScript\" class=\"expando\" src=\"http://chuahuongdao.org/hinhanh/random.php?2\" width=\"140\" height=\"110\"></SCRIPT>\n";
$content  .= "&nbsp;<SCRIPT language=\"JavaScript\" class=\"expando\" src=\"http://chuahuongdao.org/hinhanh/random.php?3\" width=\"140\" height=\"110\"></SCRIPT>\n";
$content  .= "&nbsp;<SCRIPT language=\"JavaScript\" class=\"expando\" src=\"http://chuahuongdao.org/hinhanh/random.php?4\" width=\"140\" height=\"110\"></SCRIPT>\n";
$content  .= "&nbsp;<SCRIPT language=\"JavaScript\" class=\"expando\" src=\"http://chuahuongdao.org/hinhanh/random.php?5\" width=\"140\" height=\"110\"></SCRIPT>\n";
$content  .= "&nbsp;<SCRIPT language=\"JavaScript\" class=\"expando\" src=\"http://chuahuongdao.org/hinhanh/random.php?6\" width=\"140\" height=\"110\"></SCRIPT>\n";
$content  .= "&nbsp;<SCRIPT language=\"JavaScript\" class=\"expando\" src=\"http://chuahuongdao.org/hinhanh/random.php?7\" width=\"140\" height=\"110\"></SCRIPT>\n";
$content  .= "</div></p>\n";
$content  .= "<script type=\"text/javascript\">\n";
$content  .= "marqueeInit({\n";
$content  .= "   uniqueid: 'mycrawler2',\n";
$content  .= "   style: {\n";
$content  .= "      'padding': '2px',\n";
$content  .= "      'width': '600px',\n";
$content  .= "      'height': '180px'\n";
$content  .= "   },\n";
$content  .= "   inc: 3, //speed - pixel increment for each iteration of this marquee's movement\n";
$content  .= "   mouse: 'cursor driven', //mouseover behavior ('pause' 'cursor driven' or false)\n";
$content  .= "   moveatleast: 2,\n";
$content  .= "   neutral: 150,\n";
$content  .= "   savedirection: true\n";
$content  .= "});\n";
$content  .= "</script>\n";
?>


this is the image expando script site... http://www.dynamicdrive.com/dynamicindex4/expandoimage.htm
Title: Re: [Mod] Random image / Zufallsbild
Post by: yousaf on June 08, 2009, 03:21:19 PM
@Harry,

here is it:
http://www.nicky.net/4images/random_more_pics.txt

for certain category add this: http://www.4homepages.de/forum/viewtopic.php?p=4360#4360

@ Nicky, sorry for pulling out an old post as a Quote reference
but i would like to ask for a little help, since by applying your code we get multi images in a vertical column, could you please just make a tweak and change it to horizontal position.

the current positions of images are like this

image1
image2
image3

i want them to be like .... image1  image2  image3

...........
Edited: Oops i didnt know a guy named bergblume already solved this issue (http://www.4homepages.de/forum/index.php?topic=1020.msg130514#msg130514) on the previous page(i saw it lately and i had to translate his post lolz, i dont know German, hope to learn it from benny some day :P )
anyways. i made it to work with the help of Nicky and bergblume
and i am now able to show 4 random images on a different Domain powered by Wordpress
example: http://www.pashtosms.com (http://www.pashtosms.com) see the front page
Title: Re: [Mod] Random image / Zufallsbild
Post by: CorFie on June 10, 2009, 10:01:41 PM
Ich liebe den Mod, aber ich habe eine Problem.

Bei Zirkelbilder.de haben wir zwei Galerien.
Einmal eine für die großen Bilder, einmal eine für die Avatare (unsere Avatarbase).
Ich möchte auf dem Blog von beiden Galerien die Zufallbilder zeigen.

Von der Hauptgalerie macht er es perfekt, so wie ich möchte.
Nun hab ich das ganze versucht zusätzlich mit der "Avatarbase" einzubauen und da haut er mir immer diese Fehlermeldung raus:

Code: [Select]
Warning: main(../galerie/includes/db_mysql_new.php) [function.main]: failed to open stream: No such file or directory in /www/htdocs/w0090b99/zirkelbilder/avatare.php on line 33

Warning: main(../galerie/includes/db_mysql_new.php) [function.main]: failed to open stream: No such file or directory in /www/htdocs/w0090b99/zirkelbilder/avatare.php on line 33

Warning: main() [function.include]: Failed opening '../galerie/includes/db_mysql_new.php' for inclusion (include_path='.:/usr/share/php:..') in /www/htdocs/w0090b99/zirkelbilder/avatare.php on line 33

Fatal error: Cannot redeclare is_remote() (previously declared in /www/htdocs/w0090b99/zirkelbilder/random.php:37) in /www/htdocs/w0090b99/zirkelbilder/avatare.php on line 38

Irgendwie versteh ich nicht, warum er immer auf die Galerie versucht zuzugreifen bei der db_mysql_new.php.
Denn schließlich gebe ich in der avatar.php (umbenannte random.php) vor, dass er auf die avatare zugreifen soll.
Trotzdem verweigert sich das System und ich verzweifel.

Kann mir jemand helfen?
Code: [Select]
<?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''../avatars/');

include(
ROOT_PATH.'config.php');
include(
ROOT_PATH.'includes/db_mysql_new.php');
include(
ROOT_PATH.'includes/constants.php');
define('SCRIPT_URL''http://avatare.zirkelbilder.de/');

$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)) ? 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 
"<a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=\"_new\"><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";
?>
Title: Re: [Mod] Random image / Zufallsbild
Post by: yousaf on June 22, 2009, 08:33:20 PM
I've seen modification how to make random.php work with sertan categories, but is that possible use all categories and filter the ones I dont want to use?
if I have 200+ categories this way:
Code: [Select]
AND a.cat_id IN (4, 9, 15)would be just pain...if I dont want use 2 categories...
or it would be easier if I creat a new group, then set witch categories that group can access and use this code?:
Code: [Select]
AND b.auth_viewimage=2 or that code only works as 'guest','registered', or 'admin'? (sry, dont speak  german)

Hi Vano, Did you make it work?
sorry for digging out an old post as reference, but i am also looking for a way that a specific category is excluded in the random images on external pages.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on June 22, 2009, 09:56:21 PM
hi yousaf,

if you want to exlude some categories, then use insteaf of
Code: [Select]
AND a.cat_id IN (4, 9, 15)
this

Code: [Select]
AND a.cat_id NOT IN (4, 9, 15)
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on June 22, 2009, 10:06:37 PM
Ich liebe den Mod, aber ich habe eine Problem.

Bei Zirkelbilder.de haben wir zwei Galerien.
Einmal eine für die großen Bilder, einmal eine für die Avatare (unsere Avatarbase).
Ich möchte auf dem Blog von beiden Galerien die Zufallbilder zeigen.

Von der Hauptgalerie macht er es perfekt, so wie ich möchte.
Nun hab ich das ganze versucht zusätzlich mit der "Avatarbase" einzubauen und da haut er mir immer diese Fehlermeldung raus:

Code: [Select]
Warning: main(../galerie/includes/db_mysql_new.php) [function.main]: failed to open stream: No such file or directory in /www/htdocs/w0090b99/zirkelbilder/avatare.php on line 33

Warning: main(../galerie/includes/db_mysql_new.php) [function.main]: failed to open stream: No such file or directory in /www/htdocs/w0090b99/zirkelbilder/avatare.php on line 33

Warning: main() [function.include]: Failed opening '../galerie/includes/db_mysql_new.php' for inclusion (include_path='.:/usr/share/php:..') in /www/htdocs/w0090b99/zirkelbilder/avatare.php on line 33

Fatal error: Cannot redeclare is_remote() (previously declared in /www/htdocs/w0090b99/zirkelbilder/random.php:37) in /www/htdocs/w0090b99/zirkelbilder/avatare.php on line 38

Irgendwie versteh ich nicht, warum er immer auf die Galerie versucht zuzugreifen bei der db_mysql_new.php.
Denn schließlich gebe ich in der avatar.php (umbenannte random.php) vor, dass er auf die avatare zugreifen soll.
Trotzdem verweigert sich das System und ich verzweifel.

Kann mir jemand helfen?

hi CorFie,

schick mal deine FTP daten, per PN, an mich und wohin die avatar randoms gezeigt werden.
Title: Re: [Mod] Random image / Zufallsbild
Post by: yousaf on June 23, 2009, 08:11:03 AM
hi yousaf,

if you want to exlude some categories, then use insteaf of
Code: [Select]
AND a.cat_id IN (4, 9, 15)
this

Code: [Select]
AND a.cat_id NOT IN (4, 9, 15)

Thanks Nicky
i will give it a try when i get back home. you are always there with a solution :D
Title: Re: [Mod] Random image / Zufallsbild
Post by: Moinsen on July 26, 2009, 10:16:02 AM
Kurze Frage:

Funktioniert das Random-Script auch dann, wenn das Zufallsbild auf einer externen Seite angezeigt werden soll, also auf einem anderen Webspace?

Wenn ja, müsste ich dann ganz oben im Script an dieser Stelle die vollständige Webadresse mit http://www. ... angeben?

Code: [Select]
// PATH to your 4images Gallery / PFAD zu Ihrer 4images Gallerie
define('ROOT_PATH', './bilder/');
Title: Re: [Mod] Random image / Zufallsbild
Post by: waynenort on August 13, 2009, 01:11:59 PM
Hi Nicky,

Your mod works great, if I run the random.php from the web browser.
Problem is when I include it in my html page using  <?php  include("./random.php");  ?> .... It won't  link it the  random.php file. My webhost has disabled the use of php code in html files. Is there another way of making the random.php work with my html file.

Thanks, Wayne
Title: Re: [Mod] Random image / Zufallsbild
Post by: mawenzi on August 13, 2009, 01:22:41 PM
@waynenort

... then use a iframe with random.php as content in your html-file ...
Title: Re: [Mod] Random image / Zufallsbild
Post by: waynenort on August 13, 2009, 03:20:57 PM
cheers
Title: Re: [Mod] Random image / Zufallsbild
Post by: MoXxinator on August 14, 2009, 09:51:26 AM
Ich verstehe hier nur noch Bahnhof, nachdem ich hier ungefähr 20 seiten durchgelesen habe. Ich habe den code hier

Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: random_full.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.                                                        *
 *                                                                        *
 *************************************************************************/

[color=red]// http://meine_homepage/unterordner/4images[/color]
define('ROOT_PATH''./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)) ? 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_media_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'];
$full_src = (is_remote($row['image_media_file'])) ? $row['image_media_file'] : ROOT_PATH.MEDIA_DIR."/".$cat_id."/".$row['image_media_file'];

echo 
"<a href=\"".ROOT_PATH."details.php?image_id=$image_id\"><img src=\"".$full_src."\" border=\"1\" alt=\"$image_name\"></a><br>\n";
?>

genommen und als random_php auf meinen Server geladen, so jetzt setzt es bei mir aus, habe den pfad zur 4images galerie eingegeben , aber es funktioniert nicht (rot gekennzeichnet)? Was mache ich falsch?Habe den pfad auch schon woanders eingefügt aber es klappt einfach nicht.

Danke für die hilfe
Title: Re: [Mod] Random image / Zufallsbild
Post by: Horvath on September 06, 2009, 05:05:34 AM
Is there anyway that when using this mod. . . . .  When the thumbnail is clicked the page opens up in a New/blank window?  Setting the Target for the link to blank ?

I am guessing setting the target to blank in this line somewhere. . .  Just not sure where. .  Any thoughts?

document. write('<a href=\"". SCRIPT_URL. "details. php?image_id=$image_id\"><img src=\"". $full_src. "\" border=\"1\" alt=\"$image_name\"></a>');
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on September 06, 2009, 11:33:22 PM
Is there anyway that when using this mod. . . . .  When the thumbnail is clicked the page opens up in a New/blank window?  Setting the Target for the link to blank ?

I am guessing setting the target to blank in this line somewhere. . .  Just not sure where. .  Any thoughts?

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

hi Horvath,

Code: [Select]
document. write('<a href=\"". SCRIPT_URL. "details. php?image_id=$image_id\" target=\"_blank\"><img src=\"". $full_src. "\" border=\"1\" alt=\"$image_name\"></a>');
@MoXxinator
ich verstehe auch leider nur bahnhof ;)
bitte link zu deiner gallery und zu der random.php
und denn link wo du es einfügen willst.

dann könnten wir abfahren ;)
Title: Re: [Mod] Random image / Zufallsbild
Post by: ahsancharming on September 29, 2009, 07:16:18 PM
Quote from: V@no link=topic=1020. msg12102#msg12102 date=1038641102
I think I fixed the script when it chose non picture file and shows red X.
I modified it so now it wont return full <img code, but will return full path with filename.  Plus now u can show thumbnail and/or full picture.
Code: [Select]
<?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/');  // change this to your 4images dir.
include(ROOT_PATH.'config.php');
include(
ROOT_PATH.'includes/db_mysql.php');
include(
ROOT_PATH.'includes/constants.php');
define('ICON_PATH'ROOT_PATH.TEMPLATE_DIR."/default/icons/"); // path to your template icons.
$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)) ? 0;
}
function 
get_file_extension($file_name) {
  
ereg("(.+)\.(.+)"basename($file_name), $regs);
  return 
strtolower($regs[2]);
}
function 
check_thumb_type($file_name) {
  return (
preg_match('#(gif|jpg|jpeg|png)$#is'$file_name)) ? 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_media_file, 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_extention get_file_extension($row['image_media_file']);
$image_id $row['image_id'];
$cat_id $row['cat_id'];
$image_name $row['image_name'];
$image_comments $row['image_comments'];

if (empty(
$row['image_thumb_file'])) { 
  
$thumb_src ICON_PATH."/".$image_extention.".gif"

else {
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : ROOT_PATH.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];
}
if (!
check_thumb_type($image_extention)) {
$full_src ICON_PATH."/".$image_extention.".gif";
}
else {
$full_src = (is_remote($row['image_media_file'])) ? $row['image_media_file'] : ROOT_PATH.MEDIA_DIR."/".$cat_id."/".$row['image_media_file'];
}
$full_src_link ROOT_PATH."details.php?image_id=$image_id";
?>
Now u'll need call random. php file just ones
Code: [Select]
<?php include("random.php"); ?>
after that u can show thumbnail:
Code: [Select]
<img src="<?php echo $thumb_src?>" border="1">or show full picture:
Code: [Select]
<img src="<?php echo $full_src?>" border="1">if u need add link to the image, use like this:
Code: [Select]
<a href="<?php echo $full_src_link?>">
<img src="<?php echo $thumb_src?>" border="1">
</a>



well iam getting this error . . plz help me out :idea:

Code: [Select]
Warning: include(./wallzz/config.php) [function.include]: failed to open stream: No such file or directory in /home/wallpapr/public_html/wallzz/random.php on line 29

Warning: include(./wallzz/config.php) [function.include]: failed to open stream: No such file or directory in /home/wallpapr/public_html/wallzz/random.php on line 29

Warning: include() [function.include]: Failed opening './wallzz/config.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/wallpapr/public_html/wallzz/random.php on line 29

Warning: include(./wallzz/includes/db_mysql.php) [function.include]: failed to open stream: No such file or directory in /home/wallpapr/public_html/wallzz/random.php on line 30

Warning: include(./wallzz/includes/db_mysql.php) [function.include]: failed to open stream: No such file or directory in /home/wallpapr/public_html/wallzz/random.php on line 30

Warning: include() [function.include]: Failed opening './wallzz/includes/db_mysql.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/wallpapr/public_html/wallzz/random.php on line 30

Warning: include(./wallzz/includes/constants.php) [function.include]: failed to open stream: No such file or directory in /home/wallpapr/public_html/wallzz/random.php on line 31

Warning: include(./wallzz/includes/constants.php) [function.include]: failed to open stream: No such file or directory in /home/wallpapr/public_html/wallzz/random.php on line 31

Warning: include() [function.include]: Failed opening './wallzz/includes/constants.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/wallpapr/public_html/wallzz/random.php on line 31

Fatal error: Class 'Db' not found in /home/wallpapr/public_html/wallzz/random.php on line 33
Title: Re: [Mod] Random image / Zufallsbild
Post by: mawenzi on September 29, 2009, 07:32:07 PM
@ ahsancharming

... "No such file or directory ... random.php" ...
... where is your random.php ... ?
Title: Re: [Mod] Random image / Zufallsbild
Post by: ahsancharming on September 29, 2009, 11:23:23 PM
i uploaded in my 4images gallery root

thats what inside my random. php
Code: [Select]
<?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''./wallzz/');

include(
ROOT_PATH.'config.php');
include(
ROOT_PATH.'includes/db_mysql.php');
include(
ROOT_PATH.'includes/constants.php');

define('SCRIPT_URL''http://www.wallpaperspecial.com/wallzz');

$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)) ? 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 RAND() 
        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 
"<table border='0' width='133' bgcolor='#FFFFFF' Align=left>\n";
  echo 
"<TR>\n";
  echo 
"<TD><a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=\"_blank\"> <img src=\"".SCRIPT_URL.$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
  echo 
"</TR>\n";
  echo 
"<TR>\n";
  echo 
"<TD bgcolor='#FFFFFF'> <a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=\"_blank\"> <b>$image_name</b></a><br>\n";
  echo 
"</TR>\n";
  echo 
"<TR>\n";
  echo 
"<TD bgcolor='#FFFFFF'>Kommentare: $image_comments</TD>\n";
  echo 
"</TR>\n";
  echo 
"</table>\n";
}
?>



is it correct?
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on September 29, 2009, 11:44:37 PM
if random.php is in your 4images ROOT

then

Code: [Select]
define('ROOT_PATH', './wallzz/');should be
Code: [Select]
define('ROOT_PATH', './');
and change
Code: [Select]
define('SCRIPT_URL', 'http://www.wallpaperspecial.com/wallzz');to
Code: [Select]
define('SCRIPT_URL', 'http://www.wallpaperspecial.com/wallzz/');
after changes call

http://www.wallpaperspecial.com/wallzz/random.php


and ADD ASAP 4images copyright back.
Title: Re: [Mod] Random image / Zufallsbild
Post by: ahsancharming on September 30, 2009, 02:33:22 AM
thx but i want few changes

Code: [Select]
<?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');

define('SCRIPT_URL''http://www.wallpaperspecial.com/wallzz/');

$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)) ? 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 RAND() 
        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 
"<table border='0' width='133' bgcolor='#FFFFFF' Align=left>\n";
  echo 
"<TR>\n";
  echo 
"<TD><a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=\"_blank\"> <img src=\"".SCRIPT_URL.$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
  echo 
"</TR>\n";
  echo 
"<TR>\n";
  echo 
"<TD bgcolor='#FFFFFF'> <a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=\"_blank\"> <b>$image_name</b></a><br>\n";
  echo 
"</TR>\n";
  echo 
"<TR>\n";
  echo 
"<TD bgcolor='#FFFFFF'>Views: $image_hits</TD>\n";
  echo 
"</TR>\n";
  echo 
"</table>\n";
}
?>



i've added ($image_hits) but its not working and i want USER FRIENDLY URLS.  solve theze 2 lil probs. . rest all f9.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on September 30, 2009, 09:19:05 AM
Code: [Select]
<?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');

define('SCRIPT_URL''http://www.wallpaperspecial.com/wallzz/');

$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)) ? 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, a.image_hits 
        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 RAND() 
        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'];
  
$image_hits $row['image_hits'];


  echo 
"<table border='0' width='133' bgcolor='#FFFFFF' Align=left>\n";
  echo 
"<TR>\n";
  echo 
"<TD><a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=\"_blank\"> <img src=\"".SCRIPT_URL.$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
  echo 
"</TR>\n";
  echo 
"<TR>\n";
  echo 
"<TD bgcolor='#FFFFFF'> <a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=\"_blank\"> <b>$image_name</b></a><br>\n";
  echo 
"</TR>\n";
  echo 
"<TR>\n";
  echo 
"<TD bgcolor='#FFFFFF'>Views: $image_hits</TD>\n";
  echo 
"</TR>\n";
  echo 
"</table>\n";
}
?>

about: USER FRIENDLY URLS
rightnow this is not possible from my side.
Title: Re: [Mod] Random image / Zufallsbild
Post by: ahsancharming on September 30, 2009, 03:05:47 PM
ok Copyright Tag Added on all pages of http://www.wallpaperspecial.com/wallzz/

now please solve the issue?
..

[EDIT]
i edited my previous post.
Title: Re: [Mod] Random image / Zufallsbild
Post by: ahsancharming on October 01, 2009, 06:21:30 PM
HELP NEEDED BADLY..!

http://www.wallpaperspecial.com/wallzz/random.php

i have changed the background colour but "image name" and "VIEWS" bg colour is still showing WHITE.. how can i edit the font n bg colour by my needs and also can i change the thumbnail size?

please help me out regarding this..
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on October 01, 2009, 08:49:27 PM
hi,

change you colors here
Code: [Select]
echo "<TD bgcolor='#FFFFFF'> <a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=\"_blank\"> <b>$image_name</b></a><br>\n";
Code: [Select]
echo "<TD bgcolor='#FFFFFF'>Views: $image_hits</TD>\n";
thumnails are in original size, but you can add width and height to your html code at
Code: [Select]
<img src=\"".SCRIPT_URL.$thumb_src."\" border=\"0\" alt=\"$image_name\">
and thank you for added 4images copyright back
Title: Re: [Mod] Random image / Zufallsbild
Post by: ahsancharming on October 02, 2009, 08:51:02 AM
well thanx alot but i still want it to be perfect

1) i want a hyperlink of category on category name.
2) i wont the font in "CENTER" , "VERDENA" and "Size.2".
3) is it possile to use friendly urls ?
Title: Re: [Mod] Random image / Zufallsbild
Post by: shadowhunter on October 02, 2009, 06:02:17 PM
Hallo!

Ich habe noch eine kurze Frage bezüglich Sicherheit:

Sollte bei "$image_name = $row['image_name'];" nicht eine Sicherheits-Funktion, wie "format_text(..." oder "safe_htmlspecialchars(..." oder so änlich eingebaut/berücksichtigt werden?

Danke & Gruss
Title: Re: [Mod] Random image / Zufallsbild
Post by: Rembrandt on October 02, 2009, 09:24:48 PM
Hallo!

Ich habe noch eine kurze Frage bezüglich Sicherheit:

Sollte bei "$image_name = $row['image_name'];" nicht eine Sicherheits-Funktion, ........ eingebaut/berücksichtigt werden?..


$row['image_name'] kommt aus der datenbank, ich denke da braucht man so etwas nicht, und dort sollte der image name schon bereinigt sein.
sollte der image name nicht bereinigt hinneingeschrieben werden, können man mit einer sql injektion die DB manipulieren.

mfg Andi
Title: Re: [Mod] Random image / Zufallsbild
Post by: ahsancharming on October 03, 2009, 07:50:00 AM
Hallo!

Ich habe noch eine kurze Frage bezüglich Sicherheit:

Sollte bei "$image_name = $row['image_name'];" nicht eine Sicherheits-Funktion, wie "format_text(..." oder "safe_htmlspecialchars(..." oder so änlich eingebaut/berücksichtigt werden?

Danke & Gruss

i dont understand this language ..please explain me in english
thnx
Title: Re: [Mod] Random image / Zufallsbild
Post by: mawenzi on October 03, 2009, 03:23:07 PM
@ ahsancharming

1. this language is German ( you are on a .de-domain ) ...
2. for this case we have the translation feature on the top on each site ...
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on October 03, 2009, 08:17:40 PM
well thanx alot but i still want it to be perfect

1) i want a hyperlink of category on category name.
2) i wont the font in "CENTER" , "VERDENA" and "Size.2".
3) is it possile to use friendly urls ?


1.) i will create an query for you
2.) use html codes like for the background color in my previons post
3.) no, it is not possible rightnow

Code: [Select]
<?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');

define('SCRIPT_URL''http://www.wallpaperspecial.com/wallzz/');

$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)) ? 0;
}

echo 
"<body bgcolor=\"#5D8FB5\" topmargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\" marginwidth=\"0\" marginheight=\"0\">\n";

// NUMBER OF THUMBNAILS TO DISPLAY / NUMMER DER GEWÜNSCHTEN THUMBNAILS
$num_images 1;

$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_hits, b.cat_name 
        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 RAND() 
        LIMIT 
$num_images";
$result $site_db->query($sql);

echo 
"<table border='0' width='133' bgcolor='#5D8FB5' align='left'>\n";

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'];
  
$image_hits $row['image_hits'];
  
$cat_name $row['cat_name'];


  echo 
"<tr>\n";
  echo 
"<td><a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=\"_blank\"> <img src=\"".SCRIPT_URL.$thumb_src."\" border=\"0\" alt=\"$image_name\"></a></td>\n";
  echo 
"</tr>\n";
  echo 
"<tr>\n";
  echo 
"<td><font face='Verdana' size='2'><a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=\"_blank\"><b>$image_name</b></a></font></td>\n";
  echo 
"</tr>\n";
  echo 
"<tr>\n";
  echo 
"<td><font face='Verdana' size='2'>Views: $image_hits</font></td>\n";
  echo 
"</tr>\n";
  echo 
"<tr>\n";
  echo 
"<td><font face='Verdana' size='2'><a href=\"".SCRIPT_URL."categories.php?cat_id=$cat_id\" target=\"_blank\">$cat_name</a></font></td>\n";
  echo 
"</tr>\n";
}
  echo 
"</table>\n";
?>
Title: Re: [Mod] Random image / Zufallsbild
Post by: ahsancharming on October 04, 2009, 12:34:24 AM
well thanx alot but i still want it to be perfect

1) i want a hyperlink of category on category name.
2) i wont the font in "CENTER" , "VERDENA" and "Size.2".
3) is it possile to use friendly urls ?


1.) i will create an query for you
2.) use html codes like for the background color in my previons post
3.) no, it is not possible rightnow

Code: [Select]
<?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');

define('SCRIPT_URL''http://www.wallpaperspecial.com/wallzz/');

$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)) ? 0;
}

echo 
"<body bgcolor=\"#5D8FB5\" topmargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\" marginwidth=\"0\" marginheight=\"0\">\n";

// NUMBER OF THUMBNAILS TO DISPLAY / NUMMER DER GEWÜNSCHTEN THUMBNAILS
$num_images 1;

$sql "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_hits, b.cat_name 
        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 RAND() 
        LIMIT 
$num_images";
$result $site_db->query($sql);

echo 
"<table border='0' width='133' bgcolor='#5D8FB5' align='left'>\n";

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'];
  
$image_hits $row['image_hits'];
  
$cat_name $row['cat_name'];


  echo 
"<tr>\n";
  echo 
"<td><a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=\"_blank\"> <img src=\"".SCRIPT_URL.$thumb_src."\" border=\"0\" alt=\"$image_name\"></a></td>\n";
  echo 
"</tr>\n";
  echo 
"<tr>\n";
  echo 
"<td><font face='Verdana' size='2'><a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=\"_blank\"><b>$image_name</b></a></font></td>\n";
  echo 
"</tr>\n";
  echo 
"<tr>\n";
  echo 
"<td><font face='Verdana' size='2'>Views: $image_hits</font></td>\n";
  echo 
"</tr>\n";
  echo 
"<tr>\n";
  echo 
"<td><font face='Verdana' size='2'><a href=\"".SCRIPT_URL."categories.php?cat_id=$cat_id\" target=\"_blank\">$cat_name</a></font></td>\n";
  echo 
"</tr>\n";
}
  echo 
"</table>\n";
?>


sorry iam asking u small small things..im not gud into php ..
i tried 2-3 times to to make the text in center.. :)

may i know where to add this "p align='center"</p> ?
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on October 04, 2009, 09:08:39 AM
Code: [Select]
<td align='center'>
those are NOT PHP basic  :P
Title: Re: [Mod] Random image / Zufallsbild
Post by: Rembrandt on October 04, 2009, 09:27:33 AM
Hi!
..
sorry iam asking u small small things..im not gud into php ..
i tried 2-3 times to to make the text in center.. :)

may i know where to add this "p align='center"</p> ?
its not valide.

test it:

echo "<table style=\"background-color:#5D8FB5;border-style:none;width:133px;text-align:center;\" summary=\"randomtable\">\n";

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'];
  $image_hits = $row['image_hits'];
  $cat_name = $row['cat_name'];

  echo "<tr>\n";
  echo "<td><a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" onclick=\"void(window.open(this.href, '', '')); return false;\"><img src=\"".SCRIPT_URL.$thumb_src."\" style=\"border-style:none;\" alt=\"$image_name\"></a></td>\n";
  echo "</tr>\n";
  echo "<tr>\n";
  echo "<td style=\"font-family:Verdana,Arial;font-size:12px;font-weight:bold;\"><a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" onclick=\"void(window.open(this.href, '', '')); return false;\">$image_name</a></td>\n";
  echo "</tr>\n";
  echo "<tr>\n";
  echo "<td style=\"font-family:Verdana,Arial;font-size:12px;\">Views: $image_hits</td>\n";
  echo "</tr>\n";
  echo "<tr>\n";
  echo "<td style=\"font-family:Verdana,Arial;font-size:12px;\"><a href=\"".SCRIPT_URL."categories.php?cat_id=$cat_id\" onclick=\"void(window.open(this.href, '', '')); return false;\">$cat_name</a></td>\n";
  echo "</tr>\n";
}
  echo "</table>\n";
?>


mfg Andi
Title: Re: [Mod] Random image / Zufallsbild
Post by: ahsancharming on October 04, 2009, 04:11:11 PM
Code: [Select]
<td align='center'>
those are NOT PHP basic  :P

ok thx alot..finally it works all the way right that i want.
Title: Re: [Mod] Random image / Zufallsbild
Post by: UdoB on November 25, 2009, 07:03:03 PM
Ich bekomme nun folgende Fehlermeldung wenn ich meine exterene index.php aufrufe.....Warning: include(4images/random.php) [function.include]: failed to open stream: No such file or directory in /var/www/web58/html/index.php on line 23

Warning: include() [function.include]: Failed opening '4images/random.php' for inclusion (include_path='.') in /var/www/web58/html/index.php on line 23

Title: Re: [Mod] Random image / Zufallsbild
Post by: Rembrandt on November 25, 2009, 08:25:24 PM
Ich bekomme nun folgende Fehlermeldung wenn ich meine exterene index.php aufrufe.....Warning: include(4images/random.php) [function.include]: failed to open stream: ....
hast du die random.txt im eingangspost, auch als random.php in deinem  root abgespeichert?
Title: Re: [Mod] Random image / Zufallsbild
Post by: jmschwoerer on December 13, 2009, 03:21:55 PM
Moin,

wollte diese Modifikation gerade mal angehen ... leider kommt bei mir ne hässliche Fehlermeldung - http://galerie.jmsfoto.net/random.php (http://galerie.jmsfoto.net/random.php)

Wo liegt der Fehler? Kann mir jemand weiterhelfen?

Grüße jms

PS: das ganze soll in ein wordpress-Blog eingebunden werden: http://blog.jmsfoto.net
Title: Re: [Mod] Random image / Zufallsbild
Post by: Rembrandt on December 13, 2009, 03:50:27 PM
...
wollte diese Modifikation gerade mal angehen ... leider kommt bei mir ne hässliche Fehlermeldung - ...
dein provider, oder du selbst wenn du zugriff auf die php.ini hast, hat in der php.ini "allow_url_include" auf off gestellt.
das heist es ist nicht erlaubt über eine URL eine datei einzubinden.

mfg Andi
Title: Re: [Mod] Random image / Zufallsbild
Post by: jmschwoerer on December 13, 2009, 04:18:00 PM
Bin einen Schritt weiter ....
der erste link funktioniert nun http://galerie.jmsfoto.net/random.php


Wenn ich das aber in wordpress einfüge (mit diesem Code):
Code: [Select]
<?php
 
include("../4images/random.php");
?>

Dann kommt immer noch die Fehlermeldung :(

(wo würde ich denn die php.ini finden? Ich finde keine ;(


ABER: ich habe das ganze nun etwas anders gelöst ... und zwar mit dem Plugin iFrame ;)

Grüße jms
Title: Re: [Mod] Random image / Zufallsbild
Post by: Sun on March 10, 2010, 12:44:26 PM
If i look in page http://www.mydomain.ru/gallery/random.php  then i see random picture.
But what i need to do if i want see random picture in http://www.mydomain.ru/index.html ?  I try to add this in index.html , but i didn't see anything:
Code: [Select]
<SCRIPT language='JavaScript'  src='http://www.mydomain.ru/gallery/random.php'></SCRIPT>My random.php:
Code: [Select]
// 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://www.mydomain.ru/gallery/');

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

echo "<body bgcolor=\"#5D8FB5\" topmargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\" marginwidth=\"0\" marginheight=\"0\">\n";

// NUMBER OF THUMBNAILS TO DISPLAY / NUMMER DER GEWÜNSCHTEN THUMBNAILS
$num_images = 1;

$sql = "SELECT a.image_id, a.cat_id, a.image_name, a.image_active, a.image_thumb_file, a.image_comments, a.image_hits, b.cat_name
        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 RAND()
        LIMIT $num_images";
$result = $site_db->query($sql);

echo "<table border='0' bgcolor='#5D8FB5' align='center'>\n";
echo "<tr>\n";

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'];
  $image_hits = $row['image_hits'];
  $cat_name = $row['cat_name'];

  echo "<td width='133' align='center'><a href=\"".SCRIPT_URL."details.php?image_id=$image_id\" target=\"_blank\"> <img src=\"".SCRIPT_URL.$thumb_src."\" border=\"0\" alt=\"$image_name\"></a></td>\n";
}
  echo "</tr>\n";
  echo "</table>\n";
Please, help me
Title: Re: [Mod] Random image / Zufallsbild
Post by: mawenzi on March 10, 2010, 01:19:34 PM
@ Sun ...

... for random images on your own index.php trying better this ...
... http://www.4homepages.de/forum/index.php?topic=4259.msg17513#msg17513 ...
Title: Re: [Mod] Random image / Zufallsbild
Post by: Sun on March 10, 2010, 01:32:21 PM
... for random images on your own index.php trying better this ...

Mawenzi, i use index.html, but not index.php. My index.html is not in the folder with gallery. I can't undestand how you link can help me (especially, i can't undestand how i can use {random_images} in my index.html)?

Title: Re: [Mod] Random image / Zufallsbild
Post by: mawenzi on March 10, 2010, 02:33:55 PM
@ Sun ...

... ok, my fault ... I suggested it because I thought it was your index.php ... sorry ...
... why you use a java script for inserting ...
... and why you don't use the following in your html-file (if both files are on the same server) ...

Code: [Select]
<?php
 
include("./random.php");
?>

Title: Re: [Mod] Random image / Zufallsbild
Post by: Sun on March 10, 2010, 03:34:23 PM
I am not coder and i don't know what code is better for use  :oops:
But i try this php code before i try java and there is no any picture too.
Title: Re: [Mod] Random image / Zufallsbild
Post by: mawenzi on March 10, 2010, 03:51:45 PM
@ Sun ...

... and for php including you use the right path ... from your index.html to your random.php ...  ? ...
Title: Re: [Mod] Random image / Zufallsbild
Post by: Sun on March 10, 2010, 04:31:49 PM
I think that i have error becouse i have wrong path, but i don't know how to write right path. I try different combination, but nothing didn't help.
How will be look right path if i have my files here:
http://www.mydomain.ru/index.html
http://www.mydomain.ru/gallery/random.php  ?

Title: Re: [Mod] Random image / Zufallsbild
Post by: mawenzi on March 10, 2010, 05:01:27 PM
@ Sun ...

... here some informations for including php-files in templates : http://www.4homepages.de/forum/index.php?topic=4295.0
... in includes/constants.php use this ...
Code: [Select]
// Allow execution of PHP code in templates
define('EXEC_PHP_CODE', 1);

... and in your index.html use this ...
Code: [Select]
<?php
 
include("./gallery/random.php");
?>

Title: Re: [Mod] Random image / Zufallsbild
Post by: Sun on March 10, 2010, 06:21:18 PM
My constants.php is already had this change and this changes in index.html didn't work.

But i found that this code is work:
Code: [Select]
<iframe src="/gallery/random.php" width="150" height="450" scrolling="no" frameborder="0"></iframe>
May it work whithout <iframe>?

 
Title: Re: [Mod] Random image / Zufallsbild
Post by: Sunny C. on July 07, 2010, 06:16:44 PM
Bei mir wird irgendwie kein Thumbnail angezeigt
Der Code der ausgegeben wird sieht so aus:
Code: [Select]
<div class="widget widget_archive">
<h3>Zufalls Sub</h3>
<a href="./wp-gallerie/details.php?image_id=6"><img src="./wp-gallerie/data/thumbnails/6/" alt="454545" border="0"></a><br>
<b>454545</b><br>
Comments: 0<br>
</div>
Title: Re: [Mod] Random image / Zufallsbild
Post by: Jan-Lukas on July 07, 2010, 07:22:43 PM
schon versucht wenn du die komplette Url eingibst ?

LG
Title: Re: [Mod] Random image / Zufallsbild
Post by: Sunny C. on July 08, 2010, 11:04:10 AM
Wenn ich das mache, bekomme ich folgende Meldung:
Code: [Select]
Security violationSecurity violation
Fatal error: Class 'Db' not found in /www/htdocs/w00b2576/gn/ex-random-images.php on line 34
Title: Re: [Mod] Random image / Zufallsbild
Post by: Sunny C. on July 16, 2010, 10:49:14 PM
Weis da niemand was?
Ich hab es versucht mit der kompletten URL!
Und wenn ich nicht die komplette URL verwende, dann wird das Bild nicht angezeigt!
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on July 20, 2010, 12:13:52 AM
hi Benny,

irgendwo auf diesen 43  :mrgreen: seiten ist ein javascript code welchen du beliebig auf anderen seiten (nicht 4images) einbauen kannst...
Title: Re: [Mod] Random image / Zufallsbild
Post by: Sunny C. on July 20, 2010, 05:38:07 PM
Meinst du etwa das?
Code: [Select]
document. write('<a href=\"". SCRIPT_URL. "details. php?image_id=$image_id\" target=\"_blank\"><img src=\"". $full_src. "\" border=\"1\" alt=\"$image_name\"></a>');
oder das?
Code: [Select]
<SCRIPT language='JavaScript'  src='http://gallery.rammstein-europe.com/random.php?1'></SCRIPT>
<SCRIPT language='JavaScript'  src='http://gallery.rammstein-europe.com/random.php?2'></SCRIPT>
<SCRIPT language='JavaScript'  src='http://gallery.rammstein-europe.com/random.php?3'></SCRIPT>

bzw. das?
http://www.4homepages.de/forum/index.php?topic=1020.msg126326#msg126326

Warum geht es mit dem normalen Code nicht? Und warum editierst du deinen #1 Post nicht und verlinkst dort hin? Das ist echt doof wenn man sich durch paar Seiten lesen muss weil IRGENDWO Lösungen stehen. Darum wollte ich eine Art DB erstellen wo alle Mods zu finden sind, in denen auch die Fehler und Lösungen gefixt und eingebaut wurden. Aber direkt waren alle dagegen!?
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on July 22, 2010, 03:43:15 PM
Meinst du etwa das?
Code: [Select]
document. write('<a href=\"". SCRIPT_URL. "details. php?image_id=$image_id\" target=\"_blank\"><img src=\"". $full_src. "\" border=\"1\" alt=\"$image_name\"></a>');
oder das?
Code: [Select]
<SCRIPT language='JavaScript'  src='http://gallery.rammstein-europe.com/random.php?1'></SCRIPT>
<SCRIPT language='JavaScript'  src='http://gallery.rammstein-europe.com/random.php?2'></SCRIPT>
<SCRIPT language='JavaScript'  src='http://gallery.rammstein-europe.com/random.php?3'></SCRIPT>

bzw. das?
http://www.4homepages.de/forum/index.php?topic=1020.msg126326#msg126326

Warum geht es mit dem normalen Code nicht? Und warum editierst du deinen #1 Post nicht und verlinkst dort hin? Das ist echt doof wenn man sich durch paar Seiten lesen muss weil IRGENDWO Lösungen stehen. Darum wollte ich eine Art DB erstellen wo alle Mods zu finden sind, in denen auch die Fehler und Lösungen gefixt und eingebaut wurden. Aber direkt waren alle dagegen!?


warum es nicht geht... ka. hab wordpress nicht installiert..

ich würde dies nehmen..
http://www.4homepages.de/forum/index.php?topic=1020.msg126303#msg126303

oder halt dies http://www.4homepages.de/forum/index.php?topic=1020.msg126326#msg126326
für grosse bilder..

zu deinen äusserungen werde ich kein kommentar abgeben, sonnst würde ich ein roman schreiben... und mir ist zu heiss ;)

ersten post editiere ich gleich..

LG
Title: Re: [Mod] Random image / Zufallsbild
Post by: Sunny C. on July 22, 2010, 08:16:30 PM
Kalte Dusche und dann sollte es doch klappen mit dem Antworten :D
ben88b@googlemail.com :P

B2t:
Danke dir!
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on July 22, 2010, 10:15:43 PM
Kalte Dusche und dann sollte es doch klappen mit dem Antworten :D
ben88b@googlemail.com :P

B2t:
Danke dir!

nutzt ja nichts, wenn man 2 minuten später wieder switzt...
was soll ich mit der email?
Title: Re: [Mod] Random image / Zufallsbild
Post by: Sunny C. on July 23, 2010, 05:17:59 AM
Wo du Recht hast, hast du Recht!
Mail = Mir bei Gelegenheit schreiben oder via PN! Würde gerne wissen, was Du mir dazu zusagen hast!
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nosferatu on September 30, 2010, 01:54:28 PM
Hallo,

Edit: sorry didn't work at work. on home browser it works lol

;)
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nosferatu on October 07, 2010, 04:05:36 PM
gibts eine möglichkeit, dass sich das Bild alle "5" sekunden ändern oder ähnliches ?
Title: Re: [Mod] Random image / Zufallsbild
Post by: simpley on October 08, 2010, 12:45:27 PM
Does this look right ?


<?php
define('ROOT_PATH', './gallery/');
define('SCRIPT_URL', 'http://mydomain.com/gallery/');
include(ROOT_PATH.'config.php');
include(ROOT_PATH.'includes/db_mysql.php');
include(ROOT_PATH.'includes/constants.php');
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nosferatu on October 08, 2010, 03:44:37 PM
yes thats right
Title: Re: [Mod] Random image / Zufallsbild
Post by: simpley on October 08, 2010, 06:00:05 PM
Thanks for the answer
I wasn't sure if i had got it right, but this is the whole code i have in the random.php file, but it fails to display anything, is there any other files i need to edit. I am using 1.7.7

<?php
define('ROOT_PATH', './gallery/');
define('SCRIPT_URL', 'http://mydomain.com/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_media_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'];
$full_src = (is_remote($row['image_media_file'])) ? $row['image_media_file'] : SCRIPT_URL.ROOT_PATH.MEDIA_DIR."/".$cat_id."/".$row['image_media_file'];

print("
document.write('<a href=\"".SCRIPT_URL."details.php?image_id=$image_id\"><img src=\"".$full_src."\" border=\"1\" alt=\"$image_name\"></a>');
");
?>
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nosferatu on October 08, 2010, 07:18:29 PM
your code have to work.

how do you start it ?

if you start it with browser so:

http://www.domain.com/gallery/random.php ?

it don't work!

write a test.php with

<?php
include('gallery/random.php')
?>

and save it under www.domain.com/test.php it work :D

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

you can use www.domain/gallery/random.php
Title: Re: [Mod] Random image / Zufallsbild
Post by: simpley on October 09, 2010, 02:03:21 PM
.

I now have random.php file working but i can't get my test.php file to work.

The code in my test.php points to the folder i have the random.php file in, along with the config file.

Any ideas

<?php
include(' gallery/random.php')
?>

UPDATE!

Now I have test.php working correctly but the random.php file does not.

random.php file does not show anything when i directly access it in the browser

to get the test.php to work i have this in my code

<?php
define('ROOT_PATH', './gallery/');
define('SCRIPT_URL', 'http://mydomain.com/gallery/');


AND I removed ROOT_PATH. from this line.


$full_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : SCRIPT_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];


Now that my test.php works, is it possible to create a java script so that i can run  random images on another web site using the test.php genereated images?



Title: Re: [Mod] Random image / Zufallsbild
Post by: simpley on October 10, 2010, 04:09:41 PM

Latest.

I followed these instructions and now have it working, thanks for this forum and pointing me in the right direction,, thanks again !! :lol:







hi all..
http://www.siteshot.at/nicky.htm

your examples can't work.. if you don' use correct code like descriped in the MOD file..

ROOT != ROOT_PATH  :roll:  :lol: :P 8)

use EXACT following code:


<?php
define('ROOT_PATH', './');
define('SCRIPT_URL', 'http://gallery.rammstein-europe.com/');
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_media_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'];
$full_src = (is_remote($row['image_media_file'])) ? $row['image_media_file'] : SCRIPT_URL.ROOT_PATH.MEDIA_DIR."/".$cat_id."/".$row['image_media_file'];

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


Code: [Select]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <meta http-equiv="content-type" content="text/html; charset=windows-1250">
  <meta name="generator" content="PSPad editor, www.pspad.com">
  <title></title>
  </head>
  <body>
LOL

<SCRIPT language='JavaScript'  src='http://gallery.rammstein-europe.com/random.php'></SCRIPT>
  </body>
</html>

[EDIT by V@no]
corrected index.html to avoid confusion ;) their original code was correct.

Title: Re: [Mod] Random image / Zufallsbild
Post by: www.ul-piloten.de on November 20, 2010, 10:14:13 AM
Hallo zusammen,

bei mir werden die Umlaute leider nicht korrekt (als Kästchen) angezeigt.
Ich probiere jetzt schon seit Stunden herum, finde aber leider keine Lösung.
Bin in dem Themen auch nicht so fit  :cry:

Ich hoffe das mir jemand von Euch helfen kann.

Besten Gruß
Michael
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nosferatu on November 25, 2010, 05:19:54 PM
da bist du aber hier im falschen bereicht ?

Umlaut probleme hab ich in letzter zeit auch ab und zu liegt daran, dass Browser eventuell nicht auf UTF-8 umgestellt ist bzw wenn UTF 8 eingestellt ist homepage vieleicht nicht auf UTF-8 lauft ^^ dadurch kommen umlaut fehler.
Title: Re: [Mod] Random image / Zufallsbild
Post by: nfdieter on December 16, 2010, 05:54:27 PM
Moin,

wie kann man die random.php so umbauen, das sie nicht "random", sondern alle Thumbs einer Kategorie anzeigt?

Habe das testweise mal auf http://www.unser-kleiner-zoo.eu/wordpress/testseite2/ und http://www.unser-kleiner-zoo.eu/wordpress/testseite/ probiert, aber wenn ich alle Thumbs (oder auch weniger) einsetze, werden viele doppelt gezeigt...

Hatte deshalb die Anzeige von den vorhandenen 20 auf 15 reduziert, trotzdem werden doppelte angezeigt.

Gruß Dieter

jetzt unter http://www.unser-kleiner-zoo.eu/wordpress/pony-frieda-ist-wieder-da/ zu sehen!
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on December 17, 2010, 10:53:18 PM
Moin,

wie kann man die random.php so umbauen, das sie nicht "random", sondern alle Thumbs einer Kategorie anzeigt?

Habe das testweise mal auf http://www.unser-kleiner-zoo.eu/wordpress/testseite2/ und http://www.unser-kleiner-zoo.eu/wordpress/testseite/ probiert, aber wenn ich alle Thumbs (oder auch weniger) einsetze, werden viele doppelt gezeigt...

Hatte deshalb die Anzeige von den vorhandenen 20 auf 15 reduziert, trotzdem werden doppelte angezeigt.

Gruß Dieter

hi Dieter,

poste dein code, mal sehen.
Title: Re: [Mod] Random image / Zufallsbild
Post by: nfdieter on December 18, 2010, 08:32:44 AM
Moin Nicky,


hi Dieter,

poste dein code, mal sehen.

<?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', '../fotos/');



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 = 15;

$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 = 61
        AND b.auth_viewcat=".AUTH_ALL."
        AND b.auth_viewimage=".AUTH_ALL."
        ORDER BY RAND()
        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\" target=\"_new\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a>&nbsp;\n";

 
 
}
?>

Gruß Dieter
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on December 18, 2010, 09:52:47 AM
Moin,

wie kann man die random.php so umbauen, das sie nicht "random", sondern alle Thumbs einer Kategorie anzeigt?

Habe das testweise mal auf http://www.unser-kleiner-zoo.eu/wordpress/testseite2/ und http://www.unser-kleiner-zoo.eu/wordpress/testseite/ probiert, aber wenn ich alle Thumbs (oder auch weniger) einsetze, werden viele doppelt gezeigt...

Hatte deshalb die Anzeige von den vorhandenen 20 auf 15 reduziert, trotzdem werden doppelte angezeigt.

Gruß Dieter

hi dieter,

ersetze deine abfrage:

für alle aus der kategorie:
// NUMBER OF THUMBNAILS TO DISPLAY / NUMMER DER GEWÜNSCHTEN THUMBNAILS
$num_images = 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 a.cat_id = 61
        AND b.auth_viewcat=".AUTH_ALL."
        AND b.auth_viewimage=".AUTH_ALL;
$result = $site_db->query($sql);

oder wenn du es doch limitieren willst, dann doch mit dem sql "LIMIT"
// NUMBER OF THUMBNAILS TO DISPLAY / NUMMER DER GEWÜNSCHTEN THUMBNAILS
$num_images = 20;

$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 a.cat_id = 61
        AND b.auth_viewcat=".AUTH_ALL."
        AND b.auth_viewimage=".AUTH_ALL."
        LIMIT $num_images";
$result = $site_db->query($sql);

funkts?
Title: Re: [Mod] Random image / Zufallsbild
Post by: nfdieter on December 18, 2010, 09:59:41 AM
sehr schön :D

Danke Nicky
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on December 18, 2010, 10:06:47 AM
sehr schön :D

Danke Nicky
perfekt, gern geschehen :)
Title: Re: [Mod] Random image / Zufallsbild
Post by: www.ul-piloten.de on December 18, 2010, 02:27:24 PM
Hallo, das hat auch mir sehr geholfen.
Ich habe aber noch eine Frage:
Wie muss der Code aussehen wenn ich unterhalb der Bilder noch den Bildnamen stehen haben möchte?

Gruß
Michael
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on December 18, 2010, 08:02:10 PM
Hallo, das hat auch mir sehr geholfen.
Ich habe aber noch eine Frage:
Wie muss der Code aussehen wenn ich unterhalb der Bilder noch den Bildnamen stehen haben möchte?

Gruß
Michael


hi Michael,

mit den breaks für den bildnamen in der nächsten zeile würdest dann auch nur die bilder untereinander haben.

hier der test mit den tables (4 bilder pro zeile, style für die zeilen, alle bilder aus der kategorie, siehe oben bei Dieters post wenn du doch den Limit einführen willst)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>test</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<style type="text/css">
<!--
body {
margin: 10px;
color: #000000;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 9px;
background:#FFFFFF;
}
.imagerow1 {
background: #0984f7;
}

.imagerow2 {
background: #b3cfe8;
}
-->
</style>
</head>
<body>
<?php
// 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 = 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 a.cat_id = 1450
        AND b.auth_viewcat=".AUTH_ALL."
        AND b.auth_viewimage=".AUTH_ALL;
$result = $site_db->query($sql);
  $new_images = "<table align=\"center\" border=\"0\">\n";
  $count = 0;
  $bgcounter = 0;
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'];
    if ($count == 0) {
      $row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
      $new_images .= "<tr class=\"imagerow".$row_bg_number."\">\n";
    }
    $new_images .= "<td valign=\"top\">";
    $new_images .="<a href=\"".ROOT_PATH."details.php?image_id=$image_id\" target=\"_new\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br />$image_name";
    $new_images .= "</td>\n";
    $count++;
    if ($count == 4) {
      $new_images .= "</tr>\n";
      $count = 0;
    }
}

  if ($count > 0)  {
    $leftover = (4 - $count);
    if ($leftover >= 1) {
      for ($f = 0; $f < $leftover; $f++) {
        $new_images .= "<td>&nbsp;</td>\n";
      }
      $new_images .= "</tr>\n";
    }
  }
  $new_images .= "</table>\n";

echo $new_images;
unset($new_images);
?>
</body>
</html>
Title: Re: [Mod] Random image / Zufallsbild
Post by: www.ul-piloten.de on December 18, 2010, 11:57:56 PM
Hallo Nicky,
Perfekt, vielen Dank für Deine Hilfe.  :D
Ich habe den Code noch ein wenig auf meine Website angepasst.
Funktioniert echt gut: http://www.ul-piloten.de/index.php?page=Portal

Jetzt muss ich mal suchen, ob es noch eine Möglichkeit gibt meine Thumbnails neu zu erzeugen.
Im Laufe der Zeit hatte ich die Größen geändert, so das jetzt bis zu 3 unterschiedliche Formate in der Tabelle habe.
Wenn die Thumbs alle die gleiche Größe haben sieht das bestimmt besser aus.

Oder hast Du ne Ahnung wie ich das richten kann?

Besten Gruß
Michael
Title: Re: [Mod] Random image / Zufallsbild
Post by: Rembrandt on December 19, 2010, 12:05:24 AM
....Oder hast Du ne Ahnung wie ich das richten kann?
...
bin zwar nicht Nicky aber du kannst es ja mit dem versuchen:
ACP/ auto_image_resizer
Title: Re: [Mod] Random image / Zufallsbild
Post by: www.ul-piloten.de on December 19, 2010, 09:47:35 AM
Hallo und Danke für das Feedback,

mit dem Auto-Image-Resizer kann ich die bestehenden Thumbs doch nur verkleinern, oder?
Ich möchte aber das bereits "zu kleine" Thumbs neu erzeugt werden und alle Thumbs danach eine Bildhöhe von 119 px. haben.

Besten Gruß und allen einen schönen 4. Advent.
Michael
Title: Re: [Mod] Random image / Zufallsbild
Post by: Rembrandt on December 19, 2010, 09:54:41 AM
dann lösche doch die thumbnails vom FTP und erstelle sie neu.
Title: Re: [Mod] Random image / Zufallsbild
Post by: Nicky on December 19, 2010, 10:03:24 AM
Hallo und Danke für das Feedback,

mit dem Auto-Image-Resizer kann ich die bestehenden Thumbs doch nur verkleinern, oder?
Ich möchte aber das bereits "zu kleine" Thumbs neu erzeugt werden und alle Thumbs danach eine Bildhöhe von 119 px. haben.

Besten Gruß und allen einen schönen 4. Advent.
Michael

V@no hat ein schönes    [Plugin] Rebuild Thumbnails v1.1.1 (2010-07-10) (http://www.4homepages.de/forum/index.php?topic=7059.0)  dafür.. man braucht nichts am server löschen... macht alles für dich :)
und btw. gern geschehen.
Title: Re: [Mod] Random image / Zufallsbild
Post by: www.ul-piloten.de on December 19, 2010, 04:42:36 PM
Perfekt Nicky,

genau das habe ich gebraucht  :mrgreen:
Echt toll das mir hier so spitze geholfen wird.

1.000 Dank
Michael
Title: Re: [Mod] Random image / Zufallsbild
Post by: Ruhrpottjung on June 07, 2011, 02:24:18 AM
Hallo, habe mir das ganze mal durchgelesen, was ich bräuchte wenn es machbar ist, das auf einer externen Homepage ein Zufallsbild aus einer bestimmten Kategorie angezeigt wird.
Also Beispiel: Kategorie Blumen soll auf der homepage www.domain.ltd dargestellt werden. Die Galerie befindet sich jedoch auf galerie.domain.ltd.

Das heißt will auf der www.domain.ltd ein Bild darstellen was zufällig aus der Kategorie ausgewählt wird. Am liebsten pro Tag eines, so das jeden Tag ein anderes Bild auf der Seite erscheint.

Wäre so was auch machbar?

Danke schon mal für die Antwort.
Title: Re: [Mod] Random image / Zufallsbild
Post by: jimraynor on January 31, 2012, 09:21:11 PM
i want random image thumbnails in home page. i try this http://www.4homepages.de/forum/index.php?topic=1020.0 but it doesnt work.
Title: Re: [Mod] Random image / Zufallsbild
Post by: candys on April 10, 2012, 12:51:37 AM
Habe es nach langem tüfteln hingekriegt das mir die Zufallsbilder angezeigt werden.
Jetzt ist es so das trotz der Ziel zuweisung die Gallery in dem Iframe angezeigt wird.
Wie kann ich das ändern?
Link zum Blog : Bountyhunters (http://www.bountyhunters.de)


Random.php
<?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', './gallery/');

include(ROOT_PATH.'config.php');
include(ROOT_PATH.'includes/db_mysql.php');
include(ROOT_PATH.'includes/constants.php');
define('SCRIPT_URL', 'http://www.bountyhunters.de/gallery/');

$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, b.cat_name 
        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 RAND()
        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'];
  $cat_name = $row['cat_name'];
  $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\" target=\"_self\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br>\n";
  echo "<b>$image_name</b><br>\n";
  //echo "Comments: $image_comments<hr>\n";
  echo "Kategorie:<br><a href=\"".ROOT_PATH."categories.php?cat_id=$cat_id\">\n";
echo "$cat_name<br></a>\n";

}
?>

Iframecode

<p align="center">
<iframe name="I1" scrolling="no" align="middle" border="0" frameborder="0" src="http://www.bountyhunters.de/random_mod.php" " width="133" height="600>
Ihr Browser unterstützt Inlineframes nicht oder zeigt sie in der derzeitigen Konfiguration nicht an.
</iframe></p>

Ein großes Danke an Nicky und Jan für diesen Mod.