View avatar gallery from index-page?

This forum is now closed as part of retiring phpBB2
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

This forum is now closed due to phpBB2.0 being retired.
Post Reply
wg_mithrandir
Registered User
Posts: 9
Joined: Fri Aug 15, 2003 3:47 pm
Location: Austria
Contact:

View avatar gallery from index-page?

Post by wg_mithrandir »

Hi guys!

Please be forbearing with me but I read through a lot of posts from people who didn't get their galleries working. No one mentioned a request of showing the avatar gallery outside of the user profile.

I want to make the gallery accesible to everyone regardless if he's logged in. So I could also link to new parts of the gallery when I put them online. So is it possible (seems to me like a simple requisition but I couldn't find out how to do this by myself)?

Any help and comments would be greatly appreciated ; - )

bye, mith
"No! Please! I'll tell you whatever you want!" the man yelled.
"Really?" said Vimes. "What's the orbital velocity of the moon?"
~Night Watch [Terry Pratchett]
>>> http://www.withingames.net <<<
wg_mithrandir
Registered User
Posts: 9
Joined: Fri Aug 15, 2003 3:47 pm
Location: Austria
Contact:

Post by wg_mithrandir »

Hi again!

So I guess if I want to use such a feature I'll have to implement it by myself. Though I'm working as programmer and got a little experience in PHP there may be a good chance that I'm able to do this.

But I'm not so familiar with phpBB and so I ask you to give me any approch in this matter. Please! Anyone?

bye, mith
"No! Please! I'll tell you whatever you want!" the man yelled.
"Really?" said Vimes. "What's the orbital velocity of the moon?"
~Night Watch [Terry Pratchett]
>>> http://www.withingames.net <<<
Darth Wong
Registered User
Posts: 2398
Joined: Wed Jul 03, 2002 5:20 am
Location: Toronto, Canada
Contact:

Post by Darth Wong »

There are a number of quickie PHP scripts that will display all of the images in a given directory (including a couple that have been posted on this board). Just stick one of those in the gallery directory and then give a link to that directory.

PS. And then beware of bandwidth theft if you have good avatars.
Not a three-foot tall green gnome in real-life: My home page.
My wretched hive of scum and villainy: http://bbs.stardestroyer.net/
wg_mithrandir
Registered User
Posts: 9
Joined: Fri Aug 15, 2003 3:47 pm
Location: Austria
Contact:

Post by wg_mithrandir »

Hi!

Thank you very much for your approach. I already thought that I'll maybe have to make a solution by myself. So I simply made a short PHP-Script that uses the header and footer of the board and just displays all avatars (listed by categorie). If someone else wants to use it I can put the (very unspectacular) source-code here...

-> http://www.withinboards.net/avatar_page.php

I don't think that the few avatars are so good that we'll loose that much bandwith. But if that'll come true we simply must deactivate that feature and just support uploaded avatars...

bye, mith
"No! Please! I'll tell you whatever you want!" the man yelled.
"Really?" said Vimes. "What's the orbital velocity of the moon?"
~Night Watch [Terry Pratchett]
>>> http://www.withingames.net <<<
NoFearWizz
Registered User
Posts: 11
Joined: Thu May 15, 2003 6:37 pm

Post by NoFearWizz »

can you plzz put your code here...

i want to use it on my site to.

thankyou.
wg_mithrandir
Registered User
Posts: 9
Joined: Fri Aug 15, 2003 3:47 pm
Location: Austria
Contact:

Post by wg_mithrandir »

Hi,

Better late than never ; - )

Here's my code (but it's not professional, I think):

Code: Select all

<?php

define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//

if ( !defined('IN_PHPBB') )
{
	die("Hacking attempt");
	exit;
}

$unhtml_specialchars_match = array('#>#', '#<#', '#"#', '#&#');
$unhtml_specialchars_replace = array('>', '<', '"', '&');

function display_avatar_gallery()
{
	global $board_config, $db, $template, $lang, $images, $theme;
	global $phpbb_root_path, $phpEx;

	$dir = @opendir($board_config['avatar_gallery_path']);

	$buf      = "";
	$jump_box = "";

	$jump_box.= "\n<script language=\"javascript\">\n";
	$jump_box.= "<!--\n";
	$jump_box.= "	function gotourl( url )\n";
	$jump_box.= "	{\n";
	$jump_box.= "		window.location.href = url;\n";
	$jump_box.= "	}\n";
	$jump_box.= "//-->\n";
	$jump_box.= "</script>\n";

	$jump_box.= "<A name=\"top\"></A><TABLE align=\"center\" width=\"555\"><TR><TD align=\"center\"><SELECT name=\"categorie\" size=\"1\" onchange=\"gotourl(this.options[this.selectedIndex].value)\">";

	//$buf.= "<TABLE align=\"center\">";

	$avatar_images = array();

	while( $file = @readdir($dir) )
	{
		if( $file != '.' && $file != '..' && !is_file($board_config['avatar_gallery_path'] . '/' . $file) && !is_link($board_config['avatar_gallery_path'] . '/' . $file) )
		{
			$sub_dir = @opendir($board_config['avatar_gallery_path'] . '/' . $file);

			$jump_box.= "\n<OPTION value=\"#$file\">$file</OPTION>";

			$buf.= "<TR><TD>\n<A name=\"$file\"></A><BR /><B>$file:</B> &nbsp; &nbsp; &nbsp; <A href=\"#top\">.top</A> <BR />";

			$avatar_row_count = 0;
			$avatar_col_count = 0;
			while( $sub_file = @readdir($sub_dir) )
			{
				if( preg_match('/(\.gif$|\.png$|\.jpg|\.jpeg)$/is', $sub_file) )
				{
					$avatar_images[$file][$avatar_row_count][$avatar_col_count] = $file . '/' . $sub_file;
					$avatar_name[$file][$avatar_row_count][$avatar_col_count] = ucfirst(str_replace("_", " ", preg_replace('/^(.*)\..*$/', '\1', $sub_file)));

					$img_file = 'images/avatars/gallery/' . $file . '/' . $sub_file;
					$buf.= "<IMG src=\"$img_file\" style=\"padding: 5px;\"/>&nbsp;";

					$avatar_col_count++;
					if( $avatar_col_count == 5 )
					{
						$avatar_row_count++;
						$avatar_col_count = 0;
      					$buf.= "<BR />";
					}
				}
			}

			$avatar_row_count++;
			$avatar_col_count = 0;
			$buf.= "</TD></TR>";
		}
	}

	@closedir($dir);

	$jump_box.= "</SELECT></TD></TR>";
	
	$buf.= "</TABLE>";

	echo $jump_box;
	echo $buf;

	return;
}

include($phpbb_root_path . 'includes/page_header.'.$phpEx);

$template->set_filenames(array(
	'body' => 'profile_avatar_gallery.tpl')
);

display_avatar_gallery();

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

?>
bye, mith
"No! Please! I'll tell you whatever you want!" the man yelled.
"Really?" said Vimes. "What's the orbital velocity of the moon?"
~Night Watch [Terry Pratchett]
>>> http://www.withingames.net <<<
NoFearWizz
Registered User
Posts: 11
Joined: Thu May 15, 2003 6:37 pm

Post by NoFearWizz »

thx, can you post the TPL aslo ;)

much thanks,

idd better late then never :P
Graham
Former Team Member
Posts: 8462
Joined: Tue Mar 19, 2002 7:11 pm
Location: UK
Contact:

Post by Graham »

Moved to MOD Request
"So Long, and Thanks for All the Fish"

phpBB Useful Links: Knowledge Base | Userguide | Forum Search | MOD Database | Styles Database
My Links: Blog!
Post Reply

Return to “[2.0.x] MOD Requests”