| Author |
Post |
|
|
#1 Sun Jan 21, 2007 7:24 pm
|
|
Member
Registered: Jan 2007
Posts: 5
|
I tryed to make this mod by myself... here is the code Open sources\panel_profile.php
Find (at or around line 129): $avatar_type = 0; $avatar_remote = ''; }
After add:
if ( !empty($userfile) ) { $max_image_width = 120; $max_image_height = 120; $max_image_size = 24 * 1024; $valid_types = array("gif","jpg", "JPG","JPEG", "png", "jpeg"); if (isset($userfile)) { if (is_uploaded_file($_FILES['userfile']['tmp_name'])) { $up_av=''; $filename = $_FILES['userfile']['tmp_name']; $ext = substr($_FILES['userfile']['name'], 1 + strrpos($_FILES['userfile']['name'], ".")); if (filesize($filename) > $max_image_size) { $template->parse('msgbox', 'global', array( 'box_title' => $lang['Error'], 'content' => sprintf($lang['TooBigFile']) )); } elseif (!in_array($ext, $valid_types)) { $template->parse('msgbox', 'global', array( 'box_title' => $lang['Error'], 'content' => sprintf($lang['TypeError']) )); } else { $size = GetImageSize($filename); if (($size) && ($size[0] < $max_image_width) && ($size[1] < $max_image_height)) {
if (@move_uploaded_file($filename, "/home/my_forum/www/avatars/".$session->sess_info['user_info']['id'].".".$ext)) { $up_av = 'http://my_forum/avatars/'.$session->sess_info['user_info']['id'].".".$ext;
} else { $template->parse('msgbox', 'global', array( 'box_title' => $lang['Error'], 'content' => sprintf($lang['Error']) )); } } else { $template->parse('msgbox', 'global', array( 'box_title' => $lang['Error'], 'content' => sprintf($lang['LargeSize']) )); } } } else { $template->parse('msgbox', 'global', array( 'box_title' => $lang['Error'], 'content' => sprintf($lang['EmptyFile']) )); } } $avatar_type = 1; $avatar_remote = $up_av; }
Replace /home/my_forum/www/avatars/ and http://my_forum/avatars/ to yours =========================================================
Open templates\default\panel.tpl.php
Find (at or around line 116): <tr> <td class="fieldtitle">{l_RealName}</td><td>{real_name_input}</td> </tr>
After add: <tr> <td class="fieldtitle">{l_Avatar_Upl}</td><td>{avatar_upl}</td> </tr>
=========================================================
Open languages\lang_English.php
Add before ?> $lang['Avatar_Upl'] = 'Upload Avatar'; $lang['EmptyFile'] = 'Empty File'; $lang['LargeSize'] = 'Too large sizes. Maximally possible sizes: 120*120. '; $lang['TypeError'] = 'Incorrect file type. Possible types of files: gif, jpg, png, jpeg'; $lang['TooBigFile'] = 'File is too big';
Note: add in same manner for other languages.
Excuse me for my "english", its not very good. « Last edit by Ilig on Sun Jan 21, 2007 7:26 pm. »
|
|
|
#2 Mon Jan 22, 2007 4:11 am
|
|
Member
Registered: May 2005
Posts: 298
Location: 98671
|
Thank you, am trying it, but all I get after adding all code is {avatar_upl} in edit profile, something missing.
This is all is needed to make my forum better, nothing else matters, at least for now, anyway.
|
|
|
#3 Mon Jan 22, 2007 8:01 am
|
|
Member
Registered: Jan 2007
Posts: 5
|
Oooops. I'm sorry! I missed some part of the code. Look up in the sources\panel_profile.php code 'avatar_input' => '<input type="text" size="50" maxlength="255" name="avatar_remote" value="'.unhtml(stripslashes($user_info['avatar_remote'])).'" />', And add before or after this one 'avatar_upl' =>'<input name="userfile" size="50" type="file">',
|
|
|
#4 Mon Jan 22, 2007 11:07 am
|
|
Member
Registered: May 2005
Posts: 298
Location: 98671
|
Thanks for the correction, but nothing is happening, I looked and looked at the code for anything, just do not know enough about it.
|
|
|
#5 Mon Jan 22, 2007 11:55 am
|
|
Member
Registered: May 2005
Posts: 298
Location: 98671
|
I even tried and .php file (not in allowed types) and it goes through like code was never added, something is missing, I have no idea what.
|
|
|
#6 Mon Jan 22, 2007 12:24 pm
|
|
Member
Registered: Jan 2007
Posts: 5
|
I've tested it on PHP version 4.3.10 or higher. Maybe in some other version the other syntax....
|
|
|
#7 Mon Jan 22, 2007 7:21 pm
|
|
Member
Registered: May 2005
Posts: 298
Location: 98671
|
I have PHP version 4.4.2, will look more at the code, but I know very little PHP, learning slowly though.
|
|
|
#8 Tue Jan 23, 2007 5:00 am
|
|
Member
Registered: May 2005
Posts: 298
Location: 98671
|
After much thought, removed forum, may be another time.
|
|
|
#9 Tue Jan 23, 2007 8:29 pm
|
|
Moderator
Registered: Oct 2005
Posts: 449
Location: canada
|
Ok i am completely off topic, and i'm sorry, but i need to mention it :p. William, you might want to check your website footer in Firefox 2.0  .
|
|
|
#10 Thu Mar 15, 2007 10:09 pm
|
|
Member
Registered: Mar 2007
Posts: 27
|
Hi Ilig,
i tried your script, but after filling out the upload field and saving the profil, nothing happens. Any idea?
with best regards Christiane
|
|
|
#11 Sat May 26, 2007 5:59 am
|
|
Member
Registered: May 2007
Posts: 1
|
Hi all, I am a newbie and would like the Avatar Upload Mod to work.
This is my very first post on a BB site. I am new to BB stuff and if I am reading it right this thread ended in a question with no answers. I am learning PHP and studying the UseBB code. I am good at installing PHP scripts and modifying them with good instructions.
I was looking at a XAMPP install on my laptop of both UseBB and MercuryBoard. I like the MercuryBoard's Avatar upload and resize feature. Is there a mod somewhere or is anyone actively pursuing a mod with similar features for UseBB? I am trying to develop a site with a BB for newbies and a URL field to add an avatar simply will not do, it will go over their heads. An upload option for an avatar is a must for a newbie.
|
|
|
#12 Sat May 26, 2007 12:03 pm
|
|
Developer
Registered: Apr 2004
Posts: 2218
Location: Belgium
|
UseBB 1 does not have avatar upload functionality, the above mod is the only possibility. Note mods are unsupported and not guaranteed to work in new versions.
|
|
|
#13 Thu May 31, 2007 8:45 pm
|
|
Moderator
Registered: Oct 2005
Posts: 449
Location: canada
|
Released my own version of an uploadable avatar modification. http://usebbzone.com/file.php?fid=48
|