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

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

0 Members and 1 Guest are viewing this topic.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Random image / Zufallsbild
« Reply #180 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 ;)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Vicky

  • Guest
Re: [Mod] Random image / Zufallsbild
« Reply #181 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...

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Random image / Zufallsbild
« Reply #182 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";
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Vicky

  • Guest
Re: [Mod] Random image / Zufallsbild
« Reply #183 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

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Random image / Zufallsbild
« Reply #184 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\">";
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Silaz

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #185 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 (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 :)
Greetz Silaz


[ IPB Addons | IPB Links]
*Neue Addons sind immer Willkommen

Offline PREACHER

  • Newbie
  • *
  • Posts: 16
    • View Profile
    • http://www.desktopart.de
Re: [Mod] Random image / Zufallsbild
« Reply #186 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?  :?
Schreibfehler sind beabsichtigt und dienen der allgemeinen Belustigung.

Offline OperaDivaMommy

  • Pre-Newbie
  • Posts: 6
    • View Profile
    • http://www.lyricoperala.org
Re: [Mod] Random image / Zufallsbild
« Reply #187 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/

Offline swifter_uk

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
    • http://www.hovedogs.co.uk
Re: [Mod] Random image / Zufallsbild
« Reply #188 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?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Random image / Zufallsbild
« Reply #189 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>
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline swifter_uk

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
    • http://www.hovedogs.co.uk
Re: [Mod] Random image / Zufallsbild
« Reply #190 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

Offline Reini

  • Newbie
  • *
  • Posts: 12
    • View Profile
    • http://www.fronline.de
Re: [Mod] Random image / Zufallsbild
« Reply #191 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";

Offline swifter_uk

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
    • http://www.hovedogs.co.uk
Re: [Mod] Random image / Zufallsbild
« Reply #192 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?

Offline swifter_uk

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
    • http://www.hovedogs.co.uk
Re: [Mod] Random image / Zufallsbild
« Reply #193 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:

Offline brutha

  • Pre-Newbie
  • Posts: 5
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #194 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!