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

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

0 Members and 1 Guest are viewing this topic.

Offline jscharf

  • Pre-Newbie
  • Posts: 2
    • View Profile
    • http://www.hund-und-co.de
Re: [Mod] Random image / Zufallsbild
« Reply #135 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!

Offline sorestar

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

Offline sorestar

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #137 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";
}
?>

Offline Jan

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

Offline sorestar

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


 :?:

Offline Jan

  • Administrator
  • 4images Guru
  • *****
  • Posts: 5.024
    • View Profile
    • 4images - Image Gallery Management System
Re: [Mod] Random image / Zufallsbild
« Reply #140 on: January 08, 2003, 11:24:36 PM »
Can you post line 43.

Jan
Your first three "must do" before you ask a question:
1. Forum rules
2. FAQ
3. Search

Offline sorestar

  • Newbie
  • *
  • Posts: 17
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #141 on: January 08, 2003, 11:39:16 PM »
ok this is the line

Quote
     LINE 43 ----->  FROM ".IMAGES_TABLE." a, "4images_categories" b  
[/code]

Offline Jan

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

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #143 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

?>


Offline sorestar

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

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #145 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!

Offline wrestlingwiredotnet

  • Newbie
  • *
  • Posts: 22
    • View Profile
    • http://www.wrestlingwire.net
Re: [Mod] Random image / Zufallsbild
« Reply #146 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~
visit WWW.WRESTLINGWIRE.NET if your a wrestling fan!!!

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #147 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:

Offline wrestlingwiredotnet

  • Newbie
  • *
  • Posts: 22
    • View Profile
    • http://www.wrestlingwire.net
Re: [Mod] Random image / Zufallsbild
« Reply #148 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~
visit WWW.WRESTLINGWIRE.NET if your a wrestling fan!!!

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
Re: [Mod] Random image / Zufallsbild
« Reply #149 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