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

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

0 Members and 2 Guests are viewing this topic.

Offline McMark

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

Dom01

  • Guest
Re: [Mod] Random image / Zufallsbild
« Reply #286 on: January 21, 2006, 10:30:47 PM »
Hi McMark,
schick mir mal den Quellcode per PM von der Home.html .
mfg Dom :)



Offline McMark

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

Dom01

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

Offline McMark

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

Offline ashleyXcore

  • Pre-Newbie
  • Posts: 7
    • View Profile
    • Pink-Pistol.Net
Re: [Mod] Random image / Zufallsbild
« Reply #290 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

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 #291 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...
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 ashleyXcore

  • Pre-Newbie
  • Posts: 7
    • View Profile
    • Pink-Pistol.Net
Re: [Mod] Random image / Zufallsbild
« Reply #292 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

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 #293 on: February 12, 2006, 07:37:39 AM »
You can not use full internet path in the include. use
Code: [Select]
include("random.php");
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 ashleyXcore

  • Pre-Newbie
  • Posts: 7
    • View Profile
    • Pink-Pistol.Net
Re: [Mod] Random image / Zufallsbild
« Reply #294 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

Offline |Rene|

  • Newbie
  • *
  • Posts: 47
    • View Profile
    • Bauwagencrew
Re: [Mod] Random image / Zufallsbild
« Reply #295 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

Offline |Rene|

  • Newbie
  • *
  • Posts: 47
    • View Profile
    • Bauwagencrew
Re: [Mod] Random image / Zufallsbild
« Reply #296 on: February 20, 2006, 05:04:27 PM »
Liest hier niemand mehr ?  :(

Offline Roaddog

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

Offline ashleyXcore

  • Pre-Newbie
  • Posts: 7
    • View Profile
    • Pink-Pistol.Net
Re: [Mod] Random image / Zufallsbild
« Reply #298 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?

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 #299 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";
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)