Moving Avatar from old forum to phpBB3 forum

Converting from other board software? Good decision! Need help? Have a question about a convertor? Wish to offer a convertor package? Post here.
Get Involved
Locked
rajmohan83
Registered User
Posts: 8
Joined: Wed Nov 24, 2010 2:22 pm

Moving Avatar from old forum to phpBB3 forum

Post by rajmohan83 » Fri Oct 21, 2011 4:29 pm

Hi All,

We have our own forum [ done in normal php] in our website. Now we are planning to move the existing forum to phpBB3. I have written my own code to move the topics and posts. Everything seems working fine.

Now I am facing problem in moving the avatar from existing folder forum to phpBB3 "images/avatars/upload".

Is there any way to move the old forum avatar to phpBB3 forum ?

I know there is some function which will help to migrate avatar. Please help me out to resolve this issue.

Thanks in Advance.

User avatar
D¡cky
Former Team Member
Posts: 11812
Joined: Tue Jan 25, 2005 8:38 pm
Location: New Hampshire, USA
Name: Richard Foote
Contact:

Re: Moving Avatar from old forum to phpBB3 forum

Post by D¡cky » Sat Oct 22, 2011 4:57 am

There is no tool I know of to move avatars.

There are several items involved with avatars:
Avatar salt which is in the config table
filename which is stored in the images/avatars/upload directory
Fields in the users table: user_avatar, user_avatar_type, user_avatar_width, user_avatar_height

For uploaded avatars:
  • The user_avatar field will contain the avatar in the format of: Userid underscore Uniqueid dot extension, so it will look like this for a user_id of 2, 2_13996045.jpg
  • The user_avatar_type is what type of avatar is being used. The values for this field can be found in includes/constant.php
  • user_avatar_width and user_avatar_height should be self explanatory.
The filename will be in the format of: AvatarSalt underscore Userid dot extension, f.e. 74cf083c174ae232ebd3e87b9987c851_2.jpg for user_id 2.

For gallery avatars:
The user_avatar field will be in the format of: GalleryName ForwardSlash filename
The other user_avatar fields need to be filled in also with the correct values

For remote avatars:
The user_avatar field will be in the format of: Full url to the remote image
The other user_avatar fields need to be filled in also with the correct values
Have you hugged someone today?

rajmohan83
Registered User
Posts: 8
Joined: Wed Nov 24, 2010 2:22 pm

Re: Moving Avatar from old forum to phpBB3 forum

Post by rajmohan83 » Sat Oct 22, 2011 5:56 am

Thanks for your reply.

If you dont mind can you pls let me know how to generate "user_avatar" [2_13996045.jpg] and "filename" [74cf083c174ae232ebd3e87b9987c851_2.jpg] for user id 2.

If I come to know how to generate the AvatarSalt values then I can write my own function to move the images.

Please help.

User avatar
D¡cky
Former Team Member
Posts: 11812
Joined: Tue Jan 25, 2005 8:38 pm
Location: New Hampshire, USA
Name: Richard Foote
Contact:

Re: Moving Avatar from old forum to phpBB3 forum

Post by D¡cky » Sat Oct 22, 2011 2:53 pm

rajmohan83 wrote:If I come to know how to generate the AvatarSalt values then I can write my own function to move the images.
The avatar_salt value is unique for every board. It is stored in the phpbb_config table.
rajmohan83 wrote:If you dont mind can you pls let me know how to generate "user_avatar" [2_13996045.jpg] and "filename" [74cf083c174ae232ebd3e87b9987c851_2.jpg] for user id 2.
Your present board must have a way of determining the avatar that belongs to a particular user. Once you have found a user's avatar, you copy it to phpBB renaming it in the process and enter the avatar's values into the phpbb_users table.
Have you hugged someone today?

rajmohan83
Registered User
Posts: 8
Joined: Wed Nov 24, 2010 2:22 pm

Re: Moving Avatar from old forum to phpBB3 forum

Post by rajmohan83 » Sat Oct 22, 2011 3:06 pm

Thanks for the help,

Finally I found the solution and have written a function to migrate avatar to phpBB. Here is the code

written a function to move the avatar from current forum to phpBB using following code and rename the image name and stored in phpBB - user_avatar field.

Code: Select all

// $existingAvatar - Exactly where the existing image located.
// $newImage - Exactly where I have to store the avatar for phpBB
//$imageExtention[1] old image type using  explode function ex: $imageExtention = explode('.','abc.jpg'); 
// $imageExtention[1] will "jpg".
//$newFileName - avatar salt from config table and migrate memberId.

$newFileName = $config['avatar_salt'].'_'.$memId;

list($width, $height, $type, $attr)= getimagesize($existingAvatar); 

if (@copy($existingAvatar, $newImage)) {
	$imageName = $memId.'_'.time().'.'.$imageExtention[1];
	$select_count = mysql_query("UPDATE phpbb_users SET user_avatar='$imageName',user_avatar_type='1',user_avatar_width='$width',user_avatar_height='$height'  WHERE user_id=$memId"); 
	
}
How simple it is. Enjoy and save your time. All the best. :)

rajmohan83
Registered User
Posts: 8
Joined: Wed Nov 24, 2010 2:22 pm

Re: Moving Avatar from old forum to phpBB3 forum

Post by rajmohan83 » Sat Oct 22, 2011 3:07 pm

D¡cky wrote:
rajmohan83 wrote:If I come to know how to generate the AvatarSalt values then I can write my own function to move the images.
The avatar_salt value is unique for every board. It is stored in the phpbb_config table.
rajmohan83 wrote:If you dont mind can you pls let me know how to generate "user_avatar" [2_13996045.jpg] and "filename" [74cf083c174ae232ebd3e87b9987c851_2.jpg] for user id 2.
Your present board must have a way of determining the avatar that belongs to a particular user. Once you have found a user's avatar, you copy it to phpBB renaming it in the process and enter the avatar's values into the phpbb_users table.
Thanks Dicky

WWu777
Registered User
Posts: 537
Joined: Tue Aug 14, 2007 12:40 pm
Contact:

Re: Moving Avatar from old forum to phpBB3 forum

Post by WWu777 » Thu Oct 16, 2014 9:32 pm

rajmohan83 wrote:Thanks for the help,

Finally I found the solution and have written a function to migrate avatar to phpBB. Here is the code

written a function to move the avatar from current forum to phpBB using following code and rename the image name and stored in phpBB - user_avatar field.

Code: Select all

// $existingAvatar - Exactly where the existing image located.
// $newImage - Exactly where I have to store the avatar for phpBB
//$imageExtention[1] old image type using  explode function ex: $imageExtention = explode('.','abc.jpg'); 
// $imageExtention[1] will "jpg".
//$newFileName - avatar salt from config table and migrate memberId.

$newFileName = $config['avatar_salt'].'_'.$memId;

list($width, $height, $type, $attr)= getimagesize($existingAvatar); 

if (@copy($existingAvatar, $newImage)) {
	$imageName = $memId.'_'.time().'.'.$imageExtention[1];
	$select_count = mysql_query("UPDATE phpbb_users SET user_avatar='$imageName',user_avatar_type='1',user_avatar_width='$width',user_avatar_height='$height'  WHERE user_id=$memId"); 
	
}
How simple it is. Enjoy and save your time. All the best. :)
I don't understand. How do I use that code to move the avatars from my phpbb2 to phpbb3, which did not happen during the conversion process. Was it supposed to? What do you do with that code? Where do you put it? Is it a database command?

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51187
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Moving Avatar from old forum to phpBB3 forum

Post by Brf » Fri Oct 17, 2014 1:26 am

The author of this topic has not visited here since he posted it, three years ago.

WWu777
Registered User
Posts: 537
Joined: Tue Aug 14, 2007 12:40 pm
Contact:

Re: Moving Avatar from old forum to phpBB3 forum

Post by WWu777 » Sat Oct 18, 2014 8:48 pm

Brf wrote:The author of this topic has not visited here since he posted it, three years ago.
Ok well I just PMed my question to him then.

Locked

Return to “[3.0.x] Convertors”

Who is online

Users browsing this forum: No registered users and 9 guests