Author Topic: [Mod] Random Pic in phpBB  (Read 70329 times)

0 Members and 1 Guest are viewing this topic.

Offline ai-gu

  • Newbie
  • *
  • Posts: 29
    • View Profile
[Mod] Random Pic in phpBB
« Reply #30 on: April 13, 2003, 08:02:49 AM »
V@no,

I tested two options:

1- I kept it unchanged ('data/thumbnails')
2- I changed it to ('home/krvn/html/album/data/thumbnails')

But none of them work. The album folder is the Root folder for 4images.
My phpBB and 4images are in the same database.

whatever the
define('THUMB_DIR', 'data/thumbnails'); is changed to, I got the random image thumnails like this:

http://www.krvn-online.net/album/thumbs/xx/xxx.jpg

(right mouse click on the thumb image, then select "property" I got that link)

I guess the problem must be somethings else.

I would appreciate your quick help!

here is the code

Quote
// START RANDOM PIC MOD
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: none                                                 *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *             MOD for 4images 1.7 & phpBB 2.0.2                          *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    4images ist KEINE Freeware. Bitte lesen Sie die Lizenz-             *
 *    bedingungen (http://www.4homepages.de/4images/lizenz.php) für       *
 *    weitere Informationen.                                              *
 *    ---------------------------------------------------------------     *
 *    4images is NOT freeware! Please read the Copyright Notice           *
 *    (http://www.4homepages.de/4images/lizenz_e.php) for further         *
 *    information.                                                        *
 *                                                                        *
 *************************************************************************/

// Set here the URL to your 4images Gallery. WITH trailing slash!
define('SCRIPT_URL', 'http://www.krvn-online.net/album/');

// Set here your THUMBNAIL directory. Normally no need to change. WITHOUT trailing slash!
define('THUMB_DIR', 'home/krvn/html/album/data/thumbnails');

function is_remote($file_name) {
  return (preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $file_name)) ? 1 : 0;
}

// In following queries CHANGE 4images table PREFIX if it doesn't match (Standard "4images_")!
$sql = "SELECT COUNT(*) as total_images
        FROM 4images_images a, 4images_categories b
        WHERE a.image_active=1
        AND a.cat_id = b.cat_id
        AND b.auth_viewcat=0
        AND b.auth_viewimage=0
        ";
if ( !($result = $db->sql_query($sql)) )
{
return false;
}
$row = $db->sql_fetchrow($result);
$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 4images_images a, 4images_categories b
        WHERE a.image_active=1
        AND a.cat_id = b.cat_id
        AND b.auth_viewcat=0
        AND b.auth_viewimage=0
        LIMIT $number, 1";
if ( !($result = $db->sql_query($sql)) )
{
return false;
}
$row = $db->sql_fetchrow($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'] : SCRIPT_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

$randompic = "<a href=\"".SCRIPT_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br />Image Name: $image_name<br />Comments: $image_comments\n";
// HAVE FUN
// END RANDOM PIC MOD

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
[Mod] Random Pic in phpBB
« Reply #31 on: April 13, 2003, 08:44:13 AM »
it doesnt sound right.
first, the THUMB_DIR is relative to SOURCE_DIR, that means, that the link created by combiing those two variables.
so, u can not use absolute path to THUMB_DIR.
if u dont have any thumbnails that are located on remote server (not phisicaly uploaded to your server, but just used link to it), then u can just delete the remote "detector":
Replace:
Quote
$thumb_src = (is_remote($row['image_thumb_file'])) ? $row['image_thumb_file'] : SCRIPT_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

with:
Quote
$thumb_src = SCRIPT_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];


P.S. define('THUMB_DIR', 'data/thumbnails'); is correct dont change it, leave it as it is.
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 ai-gu

  • Newbie
  • *
  • Posts: 29
    • View Profile
[Mod] Random Pic in phpBB
« Reply #32 on: April 13, 2003, 09:28:24 AM »
Thanks for your effort V@no,
But still did not work, the thumbnails is still not showing and the same as before:

http://www.krvn-online.net/album/thumbs/xx/xxx.jpg


while the correct path is:

http://krvn-online.net/album/data/thumbnails/xx/xx.jpg

Could you pliz look for any other solution,
thanks once again, and have anice weekend!!

Offline ai-gu

  • Newbie
  • *
  • Posts: 29
    • View Profile
[Mod] Random Pic in phpBB
« Reply #33 on: April 13, 2003, 12:35:13 PM »
define('THUMB_DIR', 'data/thumbnails');

$thumb_src = SCRIPT_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

Quote
$randompic = "<a href=\"".SCRIPT_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br />Image Name: $image_name<br />Comments: $image_comments\n";


Do you think that the problem araised from the red-colored text??

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
[Mod] Random Pic in phpBB
« Reply #34 on: April 13, 2003, 12:48:33 PM »
well...
and what path it shows when u change that define('THUMB_DIR', 'data/thumbnails'); ?
if it's trying pull images from the same path even that this was changed, then maybe your host use some caching? :? (just a stupid thought)
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 ai-gu

  • Newbie
  • *
  • Posts: 29
    • View Profile
[Mod] Random Pic in phpBB
« Reply #35 on: April 13, 2003, 01:10:58 PM »
hi v@no,

I got it worked!!!
Here is what I did.

First, I guessed that 'THUMB_DIR' may have been used and defined as ('THUMB_DIR', 'thumb') in other parts of page_header.php.

Second, I changed:

Quote
define('THUMB_DIR', 'data/thumbnails');


To

Quote
define('THUMB_DIRS', 'data/thumbnails');


And I changed


Quote
$thumb_src = SCRIPT_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];


To

Quote
$thumb_src = SCRIPT_URL.THUMB_DIRS."/".$cat_id."/".$row['image_thumb_file'];



And now, it works, you can check it out here: http://www.krvn-online.net

V@no, Thanks for your helps, I'll be back sometimes!

Offline Aho

  • Jr. Member
  • **
  • Posts: 55
    • View Profile
[Mod] Random Pic in phpBB
« Reply #36 on: April 14, 2003, 05:31:42 PM »
hehe,very strange ?!?!? now it works on my page too !

Offline Galeon

  • Pre-Newbie
  • Posts: 1
    • View Profile
[Mod] Random Pic in phpBB
« Reply #37 on: April 21, 2003, 11:26:08 AM »
same here, got it worked with "S"

by the way, can I specify a category/sub-category not show in random pic?

Offline frederic

  • Pre-Newbie
  • Posts: 2
    • View Profile
[Mod] Random Pic in phpBB
« Reply #38 on: May 27, 2003, 10:22:50 AM »
where is "$template->assign_vars(array(" ?
I can't find it in 1.7.

Offline RamEEz

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: [Mod] Random Pic in phpBB
« Reply #39 on: August 08, 2006, 05:28:11 PM »
^^If i am not wrong you have to find this line in PHPBB includes folder.

Offline Gibsy

  • Newbie
  • *
  • Posts: 23
    • View Profile
    • Gibsys Spielparadies
Re: [Mod] Random Pic in phpBB
« Reply #40 on: March 15, 2007, 09:03:19 AM »
Hallo,

ich habe das Problem, das die thumbnails im phpbb Portal bei mir nicht angezeigt werden  :(



und hier mein code bei page_header.php
Code: [Select]
// START RANDOM PIC MOD
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: none                                                 *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *             MOD for 4images 1.7 & phpBB 2.0.2                          *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    4images ist KEINE Freeware. Bitte lesen Sie die Lizenz-             *
 *    bedingungen (http://www.4homepages.de/4images/lizenz.php) für       *
 *    weitere Informationen.                                              *
 *    ---------------------------------------------------------------     *
 *    4images is NOT freeware! Please read the Copyright Notice           *
 *    (http://www.4homepages.de/4images/lizenz_e.php) for further         *
 *    information.                                                        *
 *                                                                        *
 *************************************************************************/

// Set here the URL to your 4images Gallery. WITH trailing slash!
define('SCRIPT_URL', 'http://www.gibsy.com/dim/4images');

// Set here your THUMBNAIL directory. Normally no need to change. WITHOUT trailing slash!
define('THUMB_DIR', 'http://www.gibsy.com/dim/4images/data/thumbnails');

function is_remote($file_name) {
  return (preg_match('#^https?\\:\\/\\/[a-z0-9\-]+\.([a-z0-9\-]+\.)?[a-z]+#i', $file_name)) ? 1 : 0;
}

// In following queries CHANGE 4images table PREFIX if it doesn't match (Standard "4images_")!
$sql = "SELECT COUNT(*) as total_images
        FROM 4images_images a, 4images_categories b
        WHERE a.image_active=1
        AND a.cat_id = b.cat_id
        AND b.auth_viewcat=0
        AND b.auth_viewimage=0
        ";
if ( !($result = $db->sql_query($sql)) )
{
return false;
}
$row = $db->sql_fetchrow($result);
$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 4images_images a, 4images_categories b
        WHERE a.image_active=1
        AND a.cat_id = b.cat_id
        AND b.auth_viewcat=0
        AND b.auth_viewimage=0
        LIMIT $number, 1";
if ( !($result = $db->sql_query($sql)) )
{
return false;
}
$row = $db->sql_fetchrow($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'] : SCRIPT_URL.THUMB_DIR."/".$cat_id."/".$row['image_thumb_file'];

$randompic = "<a href=\"".SCRIPT_URL."details.php?image_id=$image_id\"><img src=\"".$thumb_src."\" border=\"0\" alt=\"$image_name\"></a><br />Bild Name: $image_name<br />Kommentare: $image_comments\n";
// HAVE FUN
// END RANDOM PIC MOD

alle Kategorien sind auf Registrierung gestellt bis auf eins und nur dieser zeigt an aber auch nur als Link, es müsste doch alle Kategorien Ordner anzeigen mit thumbnails da bei mir 4images mit phpbb integriert wurde!

Aber zuerst das Problem das die thumbnails nicht anzeigen, siehe Bild oben.

Ich wäre über Eure hilfe und vorschläge sehr dankbar.

by Gibsy

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: [Mod] Random Pic in phpBB
« Reply #41 on: March 15, 2007, 04:06:28 PM »
Hallo,

Code in der page_header.php? Ist das richtig ??

Schau mal hier:
http://www.4homepages.de/forum/index.php?topic=1020.0   :wink:


cu
Kurt

Offline Gibsy

  • Newbie
  • *
  • Posts: 23
    • View Profile
    • Gibsys Spielparadies
Re: [Mod] Random Pic in phpBB
« Reply #42 on: March 16, 2007, 10:19:54 AM »
Code in der page_header.php? Ist das richtig ??

Ja, so hat Nicky in seinem ersten Beitrag geschrieben  :wink:

Offline olgaart

  • Newbie
  • *
  • Posts: 45
    • View Profile
    • FotoClub
Re: [Mod] Random Pic in phpBB
« Reply #43 on: October 17, 2008, 01:56:26 PM »
Hallo Nicky,
would it be possible to make a link to member´s fotos in phpbb-member profile, like url_show_user_images in 4images member profile? Many thanks.