[Awaiting Validation] Flash Avatar

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Hawaiian Dude
Registered User
Posts: 109
Joined: Mon Jun 17, 2002 10:59 am

[Awaiting Validation] Flash Avatar

Post by Hawaiian Dude » Sun Jun 23, 2002 7:16 am

I made a mod so your users can select a flash file for avatar
#################################################################
## Mod Title: Flash Avatar
## Mod Version: 1.3
## Author: Hawaiian Dude < chamel30n@pandora.be > Steve
## Description:
## With this Mod a user can select a flash file for his/her avatar.
##
##
##
## Installation Level: easy
## Installation Time: 2-5 Minutes
## Files To Edit: viewtopic.php,
## usercp_viewprofile.php,
## usercp_avatar.php,
## usercp_register.php
## Included Files: N/A
#################################################################
## This MOD is released under the GPL License.
## Intellectual Property is retained by the MOD Author(s) listed above
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
##############################################################
## Authors Notes:
##
## Now updated for phpBB 2.0.3
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
#################################################################

#
#-----[ OPEN ]---------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]---------------------------------------------
#
if ( $postrow[$i]['user_avatar_type'] && $poster_id != ANONYMOUS && $postrow[$i]['user_allowavatar'] )
{
switch( $postrow[$i]['user_avatar_type'] )
{
case USER_AVATAR_UPLOAD:
$poster_avatar = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $postrow[$i]['user_avatar'] . '" alt="" border="0" />' : '';
break;
case USER_AVATAR_REMOTE:
$poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $postrow[$i]['user_avatar'] . '" alt="" border="0" />' : '';
break;
case USER_AVATAR_GALLERY:
$poster_avatar = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $postrow[$i]['user_avatar'] . '" alt="" border="0" />' : '';
break;
}
}

#
#-----[ REPLACE WITH ]--------------------------------------
#
if ( $postrow[$i]['user_avatar_type'] && $poster_id != ANONYMOUS && $postrow[$i]['user_allowavatar'] )
{
if ( strpos ( $postrow[$i]['user_avatar'], ".swf" ) != 0 ) {
$first_part = '<embed src="';
$second_part = '" quality="high" width=60 height=60 type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/dow ... kwaveFlash" />';
} else {
$first_part = '<img src="';
$second_part = '" alt="" border="0" />';
}
switch( $postrow[$i]['user_avatar_type'] )
{
case USER_AVATAR_UPLOAD:
$poster_avatar = ( $board_config['allow_avatar_upload'] ) ? $first_part . $board_config['avatar_path'] . '/' . $postrow[$i]['user_avatar'] . $second_part : '';
break;
case USER_AVATAR_REMOTE:
$poster_avatar = ( $board_config['allow_avatar_remote'] ) ? $first_part . $postrow[$i]['user_avatar'] . $second_part : '';
break;
case USER_AVATAR_GALLERY:
$poster_avatar = ( $board_config['allow_avatar_local'] ) ? $first_part . $board_config['avatar_gallery_path'] . '/' . $postrow[$i]['user_avatar'] . $second_part : '';
break;
}
}

#
#-----[ OPEN ]---------------------------------------------
#
includes/usercp_viewprofile.php

#
#-----[ FIND ]---------------------------------------------
#
if ( $profiledata['user_avatar_type'] && $profiledata['user_allowavatar'] )
{
switch( $profiledata['user_avatar_type'] )
{
case USER_AVATAR_UPLOAD:
$avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
break;
case USER_AVATAR_REMOTE:
$avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
break;
case USER_AVATAR_GALLERY:
$avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $profiledata['user_avatar'] . '" alt="" border="0" />' : '';
break;
}
}

#
#-----[ REPLACE WITH ]--------------------------------------
#
if ( $profiledata['user_avatar_type'] && $profiledata['user_allowavatar'] )
{
if ( strpos ( $profiledata['user_avatar'], ".swf" ) != 0 ) {
$first_part = '<embed src="';
$second_part = '" quality="high" width=60 height=60 type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/dow ... kwaveFlash" />';
} else {
$first_part = '<img src="';
$second_part = '" alt="" border="0" />';
}
switch( $profiledata['user_avatar_type'] )
{
case USER_AVATAR_UPLOAD:
$avatar_img = ( $board_config['allow_avatar_upload'] ) ? $first_part . $board_config['avatar_path'] . '/' . $profiledata['user_avatar'] . $second_part : '';
break;
case USER_AVATAR_REMOTE:
$avatar_img = ( $board_config['allow_avatar_remote'] ) ? $first_part . $profiledata['user_avatar'] . $second_part : '';
break;
case USER_AVATAR_GALLERY:
$avatar_img = ( $board_config['allow_avatar_local'] ) ? $first_part . $board_config['avatar_gallery_path'] . '/' . $profiledata['user_avatar'] . $second_part : '';
break;
}
}

#
#-----[ OPEN ]---------------------------------------------
#
includes/usercp_avatar.php

#
#-----[ FIND ]---------------------------------------------
#
function check_image_type(&$type, &$error, &$error_msg)
{
global $lang;

switch( $type )
{
case 'jpeg':
case 'pjpeg':
case 'jpg':
return '.jpg';
break;

#
#-----[ REPLACE WITH ]--------------------------------------
#
function check_image_type(&$type, &$error, &$error_msg)
{
global $lang;

switch( $type )
{
case 'application/x-shockwave-flash':
return '.swf';
break;
case 'jpeg':
case 'pjpeg':
case 'jpg':
return '.jpg';
break;

#
#-----[ FIND ]---------------------------------------------
#
function user_avatar_url($mode, &$error, &$error_msg, $avatar_filename)
{
if ( !preg_match('#^(http)|(ftp):\/\/#i', $avatar_filename) )
{
$avatar_filename = 'http://' . $avatar_filename;
}

if ( !preg_match('#^((http)|(ftp):\/\/[a-z0-9\-]+?\.([a-z0-9\-]+\.)+[a-z]+(:[0-9]+)*\/.*?\.(gif|jpg|jpeg|png)$)#is', $avatar_filename) )
{

#
#-----[ REPLACE WITH ]--------------------------------------
#
function user_avatar_url($mode, &$error, &$error_msg, $avatar_filename)
{
if ( !preg_match('#^(http)|(ftp):\/\/#i', $avatar_filename) )
{
$avatar_filename = 'http://' . $avatar_filename;
}

if ( !preg_match('#^((http)|(ftp):\/\/[a-z0-9\-]+?\.([a-z0-9\-]+\.)+[a-z]+(:[0-9]+)*\/.*?\.(gif|jpg|jpeg|png|swf)$)#is', $avatar_filename) )
{

#
#-----[ FIND ]---------------------------------------------
#
else if ( $avatar_mode == 'local' && file_exists($avatar_filename) && preg_match('/\.(jpg|jpeg|gif|png)$/i', $avatar_realname) )
{

#
#-----[ REPLACE WITH ]--------------------------------------
#
else if ( $avatar_mode == 'local' && file_exists($avatar_filename) && preg_match('/\.(jpg|jpeg|gif|png|swf)$/i', $avatar_realname) )
{

#
#-----[ OPEN ]---------------------------------------------
#
includes/usercp_register.php

#
#-----[ FIND ]---------------------------------------------
#
if ( $user_avatar_type )
{
switch( $user_avatar_type )
{
case USER_AVATAR_UPLOAD:
$avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $user_avatar . '" alt="" />' : '';
break;
case USER_AVATAR_REMOTE:
$avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $user_avatar . '" alt="" />' : '';
break;
case USER_AVATAR_GALLERY:
$avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $user_avatar . '" alt="" />' : '';
break;
}
}

#
#-----[ REPLACE WITH ]--------------------------------------
#
if ( $user_avatar_type )
{
if ( strpos ( $user_avatar, ".swf" ) != 0 ) {
$first_part = '<embed src="';
$second_part = '" quality="high" width=60 height=60 type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/dow ... kwaveFlash" />';
} else {
$first_part = '<img src="';
$second_part = '" alt="" border="0" />';
}
switch( $user_avatar_type )
{
case USER_AVATAR_UPLOAD:
$avatar_img = ( $board_config['allow_avatar_upload'] ) ? $first_part . $board_config['avatar_path'] . '/' . $user_avatar . $second_part : '';
break;
case USER_AVATAR_REMOTE:
$avatar_img = ( $board_config['allow_avatar_remote'] ) ? $first_part . $user_avatar . $second_part : '';
break;
case USER_AVATAR_GALLERY:
$avatar_img = ( $board_config['allow_avatar_local'] ) ? $first_part . $board_config['avatar_gallery_path'] . '/' . $user_avatar . $second_part : '';
break;
}
}

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM

WARNING: dont know why but some special thingys are here wrong like the & caracter is here & :? so I had to use quote and not code
Everything working for me, please test it

Waiting for validation
Last edited by Hawaiian Dude on Sun Feb 02, 2003 2:10 pm, edited 8 times in total.

bobulatorm
Registered User
Posts: 1
Joined: Thu Jul 11, 2002 4:21 pm

Post by bobulatorm » Thu Jul 11, 2002 4:23 pm

works for me :) nice one chap

User avatar
Joe Batman
Registered User
Posts: 66
Joined: Mon Feb 11, 2002 1:22 am

thank u

Post by Joe Batman » Fri Jul 19, 2002 7:51 pm

Thank's Hawaiian Dude, will give it a try!
Help save our valuable bats!

radmanics
Registered User
Posts: 307
Joined: Sat Mar 30, 2002 3:29 pm
Location: England
Contact:

Post by radmanics » Sat Jul 20, 2002 11:05 am

does this make a new avatar type? if not i think it would be a better idea, as you cant display flash files in img tags can u? Im just think this because I have several avatar grabing scripts on my front page that only use img tags. I know you can use if to find the file type and stuff, but maybe you could think about a new image type for the full or next version?

Hawaiian Dude
Registered User
Posts: 109
Joined: Mon Jun 17, 2002 10:59 am

Post by Hawaiian Dude » Wed Jul 24, 2002 8:01 am

sorry for the late response but no you can't use a flash file in a img tag (tested it many times) you have to place a flash file in a embed-tag.
And yes I can add as many files as possible
eg: a movie would use the same thing as a flash file

radmanics
Registered User
Posts: 307
Joined: Sat Mar 30, 2002 3:29 pm
Location: England
Contact:

Post by radmanics » Wed Jul 24, 2002 10:21 am

so, do you think you could make it use a new avatar type?

Hawaiian Dude
Registered User
Posts: 109
Joined: Mon Jun 17, 2002 10:59 am

Post by Hawaiian Dude » Wed Jul 24, 2002 1:32 pm

yep, what type do you have in mind?

radmanics
Registered User
Posts: 307
Joined: Sat Mar 30, 2002 3:29 pm
Location: England
Contact:

Post by radmanics » Wed Jul 24, 2002 1:52 pm

I mean how the type is sotred in the data base, 0, 1, 2 i think :P so you should make this a type 3 av, that way, you can have alot better control over how its displayed :D

Hawaiian Dude
Registered User
Posts: 109
Joined: Mon Jun 17, 2002 10:59 am

Post by Hawaiian Dude » Sat Jul 27, 2002 5:52 pm

uhm don't get it there is only 1 avatar type in database

User avatar
IDB
Registered User
Posts: 67
Joined: Thu Jan 17, 2002 10:52 pm
Location: Milwaukee, Wi
Contact:

Post by IDB » Thu Sep 12, 2002 1:50 am

Which version of phpBB was this written for as I can't get it to work using 2.0.1 ?
Regards, Ian.

Unknown AD
Registered User
Posts: 3
Joined: Tue Aug 06, 2002 4:53 pm

Post by Unknown AD » Mon Sep 16, 2002 8:32 am

IDB wrote: Which version of phpBB was this written for as I can't get it to work using 2.0.1 ?
Same as me :(

redwing_talon
Registered User
Posts: 315
Joined: Mon Nov 04, 2002 12:15 am
Location: eastern US
Contact:

HELP>Errors!

Post by redwing_talon » Mon Nov 04, 2002 6:39 am

Running this mod on phpBB 2.0.3. When i try to upload flash avatar get these errors:

Warning: Cannot add header information - headers already sent by (output started at /public_html/boards/includes/usercp_avatar.php:349) in /public_html/boards/includes/page_header.php on line 449

Warning: Cannot add header information - headers already sent by (output started at /public_html/boards/includes/usercp_avatar.php:349) in /public_html/boards/includes/page_header.php on line 450

Warning: Cannot add header information - headers already sent by (output started at /public_html/boards/includes/usercp_avatar.php:349) in /public_html/boards/includes/page_header.php on line 451

Also happen on any avatar upload now, but will upload pics still?

Any help greatly appriciated, Thanks

Brandons
I am too lazy to register

Post by Brandons » Sun Dec 01, 2002 9:59 pm

you probably made a mistake on your usercp_register.php thats where the edit profile / register upload info is contained. recheck you edited that file correctly.

LordOden
Registered User
Posts: 56
Joined: Wed Sep 11, 2002 5:00 pm
Contact:

Post by LordOden » Mon Dec 02, 2002 3:08 am

works for 2.03 just wish i could figure out how to make it show the the display avatar on main page hack
Dreams And Fantasy Are Ways To Get Away From A Boring and Every Day Life, That Is Where Myths And Magic Begins!

Iron-Monkey
Registered User
Posts: 284
Joined: Sat Nov 17, 2001 12:18 am
Location: California, USA

Post by Iron-Monkey » Mon Dec 02, 2002 3:42 am

LordOden wrote: works for 2.03 just wish i could figure out how to make it show the the display avatar on main page hack


Yeah, I had the exact problem. I tried everything to get it to work for the correct display in the index page but I keep getting the X broken image. Otherwise, it works great in the viewtopic page....and I guess this is the main objective of this mod. Only you can see the broken image in the index page so it is not a really big deal.

Locked

Return to “[2.0.x] MODs in Development”