51

Re: MOD: Photo thumbnail for avatars in punbb

not exactly .. but like this it works:

<?php
/*
View user thumbnails from anywhere (viewthumb.php)
Author: Steve
Website: [url=http://www.kinkyspace.net]www.kinkyspace.net[/url]
Adapted to 2.5.6 by radioact
*/

// look for server path at config.php line 16 

include_once "//PUT HERE THE CONFIG-PATH//";

$db_username = "/PUT HERE THE USERNAME OF THE DB/";
$db_password = "/PUT HERE THE PASSWORD OF THE DB/";
$db_name = "/PUT HERE THE NAME OF THE DB/";
$db_server ="/PUT HERE THE HOST OF DB - 99% is LOCALHOST/";
$table_prefix ="/PUT HERE THE USERNME OF THE VLD TABLES - 99% is vld_/";
$vir_path ="/PUT HERE THE PATH OF YOUR SITE - GET THE INFO IN CONFIG-PHP/";
$vir_pic_path = "/PUT HERE THE PATH OF THE UPLOAD-FOLDER - GET THE INFO IN CONFIG-PHP/";
$vir_nophoto_path ="http://www.domain.com/templates/YOURTEMPLATE/media/user_picture_none.gif";


/*
Don't Edit below this line unless you know what you are doing
*/

$user = trim($_GET['user']);

if (preg_match("/^\w{1,30}$/", $user, $matches)) {
}
else // Could be a SQL injection so we don't go any further, goodbye
{
  exit();
}

$dbcnx = @mysql_connect($db_server, $db_username, $db_password);
if (!$dbcnx) {
  echo( "<P>Unable to connect to the " .
        "database server at this time. Kein Connect!</P>" );
  exit();
}

if (! @mysql_select_db($db_name) ) {
  echo( "<P>Unable to locate the " .
        "database at this time.</P>" );
  exit();
}

$sql = "SELECT m.* FROM " . $table_prefix . "members AS m WHERE m.username='$user'";

$result = mysql_query($sql);

while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
    $photo = $row['picture'];
    $member_id = $row['member_id'];
    $joindate = $row['joindate'];
    
    $media_path = substr($joindate, -1, 1).'/'.
             substr($joindate, -2, 1).'/'.
             substr($joindate, -3, 1).'/'.
             substr($joindate, -4, 1).'/'.
             $member_id.'/';
}

mysql_close($dbcnx);

if($photo){
    readfile( $vir_pic_path . $media_path . 't_photo_'.$photo);
}
else
{
    readfile($vir_nophoto_path);
}

?>


This HEADER dosnt work:

define('DB_SERVER',        $conf['db_hostname']);
define('DB_USERNAME',    $conf['db_username']);
define('DB_PASSWORD',    $conf['db_password']);
define('DB_NAME',        $conf['db_name']);
define('TABLE_PREFIX',    $conf['db_prefix']);
define('VIR_PATH',         $conf['virtual_path']);
define('VIR_PIC_PATH',     $conf['virtual_pic_path']);


THX a many hugs an kisses from simona!

52

Re: MOD: Photo thumbnail for avatars in punbb

Welcome,
1. You should just put correct path to config.php at line 10, so you wouldn't need to enter sensitive server details into "unreliable" file (viewthumb.php)

2. I forgot to mention here you should just put user_picture_none.gif into /media/ folder.

www.vldMagic.com - first choice customizations help desk
www.vldCrowd.com/radioact - my profile at vldCrowd

53

Re: MOD: Photo thumbnail for avatars in punbb

Thank you so much Radioact. The modification works flawlessly.

54

Re: MOD: Photo thumbnail for avatars in punbb

Hi,

I am trying to use this mod with 2.5.7 and Punn 1.3.4 but have not gotten to work yet.

I created viewthumb.php and added data from /includes/config.php

define('DB_SERVER',    $conf['localhost');
define('DB_USERNAME',    $conf['xxxx']);
define('DB_PASSWORD',    $conf['xxxx]);
define('DB_NAME',                 $conf['xxxx']);
define('TABLE_PREFIX',    $conf['vld_']);
define('VIR_PATH',     $conf['http://xxxx.com/']);
define('VIR_PIC_PATH',     $conf['http://xxxx.com/media/uploads/']);

However I look for $user_avatar = ''; in punbb file viewtopic.php to change to $user_avatar = '<img src="http://www.yoursite.com/viewthumb.php?user='.$cur_post['username'].'" />'; but cannot find.

Perhaps this file has changed in 1.3.4?

I think after this mod works I am to disable the use of avatars in Punn administration panel.

Thanks for helping with information!

55

Re: MOD: Photo thumbnail for avatars in punbb

kinkyspace.net wrote:

This is a mod that will show a users default vld photo thumbnail as an avatar in punbb. This php script should be able to be used for any of the forum integrations as it just needs to be called like an image.

Eg.

<img src="http://www.yoursite.com/viewthumb.php?user=somebodysusername">

Edit the top of the php script and add your database name, username, password, and if needed the database prefix. Then modify the image location where your user images are stored and the default no photo image and save it as viewthumb.php.

Then edit the punbb file viewtopic.php and change line 219 from:

$user_avatar = '';

To:

$user_avatar = '<img src="http://www.yoursite.com/viewthumb.php?user='.$cur_post['username'].'" />';

Steve

This is no longer used in the latest version of punbb $user_avatar = '';

Can anybody tell me what the new code I should used? And what directory should i load viewthumb.php?

thanks

Last edited by thejackal (2011-03-25 09:30:53)

VPS & Dedicated Hosting Servint