4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 21, 2018, 06:57:03 PM

Login with username, password and session length
Search:     Advanced search
Togle to toolbar
Translate this page with =>
Translate this page >
* Home Help Search Login Register
 
+  4images Forum & Community
|-+  4images Modifications / Modifikationen
| |-+  Mods & Plugins (Releases & Support) (Moderators: mawenzi, Rembrandt)
| | |-+  [Mod] Random image / Zufallsbild
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] 2 3 4 5 ... 45 » »» Print
Current Topic Rating: *****
Author Topic: [Mod] Random image / Zufallsbild  (Read 680428 times)
Nicky
Administrator
4images Guru
*****
Offline Offline

Posts: 3195

Thank You
-Given: 26
-Receive: 54


View Profile
« on: July 12, 2002, 10:43:02 AM »

 Deutsch hi an alle
 English hi all,

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

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

 Deutsch speichere den inhalt als random.php
 English save the content as random.php

 Deutsch random.php wurde mit folgenden befehl z.b. in die datei random_mod.php inkludiert
 English random.php was included as example into the random_mod.php site with

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


 Deutsch viel spass
 English have fun

p.s.:
 Deutsch vielen dank an JAN der 99% der arbeit geleistet hat Wink
 English many thanks to JAN who maked 99% of this mod Wink


# 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

* random.txt (3.53 KB - downloaded 1159 times.)
« Last Edit: July 22, 2010, 03:44:53 PM by Nicky » Logged

cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi
kralle
Newbie
*
Offline Offline

Posts: 23

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #1 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:

1
2

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:

1
2

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:


1
2

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
Logged
Nicky
Administrator
4images Guru
*****
Offline Offline

Posts: 3195

Thank You
-Given: 26
-Receive: 54


View Profile
« Reply #2 on: July 12, 2002, 01:22:34 PM »

*g*

gerne, gerne..

ist ja selbstveständlich..

oder target=\"FrameName\" Wink
Logged

cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi
Chris
4images Moderator
4images Guru
*****
Offline Offline

Posts: 4487

Thank You
-Given: 0
-Receive: 31

Did u ever stop to think and then forget to start?


View Profile
« Reply #3 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???
Logged

Nicky
Administrator
4images Guru
*****
Offline Offline

Posts: 3195

Thank You
-Given: 26
-Receive: 54


View Profile
« Reply #4 on: July 12, 2002, 06:08:10 PM »

hi chris,

you mean like that
Logged

cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi
Chris
4images Moderator
4images Guru
*****
Offline Offline

Posts: 4487

Thank You
-Given: 0
-Receive: 31

Did u ever stop to think and then forget to start?


View Profile
« Reply #5 on: July 12, 2002, 06:24:17 PM »

Yeah, that's it !

Can you post the code for me?
Logged

Nicky
Administrator
4images Guru
*****
Offline Offline

Posts: 3195

Thank You
-Given: 26
-Receive: 54


View Profile
« Reply #6 on: July 12, 2002, 06:29:41 PM »

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

have fun

* random_full.txt (3.37 KB - downloaded 288 times.)
« Last Edit: December 11, 2007, 05:21:29 PM by kai » Logged

cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi
dabri
Jr. Member
**
Offline Offline

Posts: 92

Thank You
-Given: 0
-Receive: 0


View Profile WWW
« Reply #7 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
Logged
Nicky
Administrator
4images Guru
*****
Offline Offline

Posts: 3195

Thank You
-Given: 26
-Receive: 54


View Profile
« Reply #8 on: July 12, 2002, 07:39:04 PM »

wo befindet sich die random.php ?
Logged

cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi
Nicky
Administrator
4images Guru
*****
Offline Offline

Posts: 3195

Thank You
-Given: 26
-Receive: 54


View Profile
« Reply #9 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)
1
2

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


füge dies ein (E: add this(ofcourse your own url))
1
2

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


dann ändere (E: change):
1
2
3
4

$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):
1
2
3
4

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

cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi
dabri
Jr. Member
**
Offline Offline

Posts: 92

Thank You
-Given: 0
-Receive: 0


View Profile WWW
« Reply #10 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
Logged
timblount
Pre-Newbie

Offline Offline

Posts: 9

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #11 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
Logged
Nicky
Administrator
4images Guru
*****
Offline Offline

Posts: 3195

Thank You
-Given: 26
-Receive: 54


View Profile
« Reply #12 on: July 13, 2002, 08:40:03 AM »

@timblount
sure!

in the two queries put

1
2

AND a.cat_id=XXX


XXX = where is your category number
Logged

cheers
Nicky
Your first three "must do" before you ask a question ! (© by V@no)
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

nicky.net 4 4images
Signature stolen from mawenzi
timblount
Pre-Newbie

Offline Offline

Posts: 9

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #13 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


 Question

-Tim
Logged
Chris
4images Moderator
4images Guru
*****
Offline Offline

Posts: 4487

Thank You
-Given: 0
-Receive: 31

Did u ever stop to think and then forget to start?


View Profile
« Reply #14 on: July 22, 2002, 07:38:33 PM »

1
2
3
4
5
6
7
$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.
Logged

Pages: [1] 2 3 4 5 ... 45 » »» Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.051 seconds with 19 queries.
Post your comments here