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

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

0 Members and 1 Guest are viewing this topic.

Offline irocracer

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

Offline irocracer

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

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 #122 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.
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 dokterjur

  • Pre-Newbie
  • Posts: 3
    • View Profile
    • http://www.beachhousepaal1.com
Re: [Mod] Random image / Zufallsbild
« Reply #123 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.
E.H.B.O.

Offline irocracer

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

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 #125 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?
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 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 #126 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. ;)
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 irocracer

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #127 on: December 04, 2002, 08:33:36 PM »
nope , same problem ... x boxes .... humm there has to be a way

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Re: [Mod] Random image / Zufallsbild
« Reply #128 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
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline BerKay

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

Offline BerKay

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

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
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 irocracer

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

Offline Grummel

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

Offline irocracer

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