It is done!
Steps I took (globally):
1) Convert with ImageMagick to png:
for JPG in *.jpg; do
PNG="${JPG%%.*}.png"
convert -resize 96x96 "$JPG" "../converted/$PNG"
done
2) Manually rename avatars to ‘user_login’_avatar.png (check user_meta for phpbb_user_id, phpbb_user_login, phpbb_user_avatar):
cp -vf "711d7fbb7058b86d9a07750a767ee787_2.png" "./avatars/userlogin_avatar.png"
3) Place the phpbb avatars in the uploads directory or a sub-directory of the uploads directory (I did the latter).
4) Place the following script as import_phpbb_avatars.php in the base directory, open a browser and point to the script:
<?php
function find_wordpress_base_path() {
$dir = dirname(__FILE__);
do {
//it is possible to check for other files here
if( file_exists($dir."/wp-config.php") ) {
return $dir;
}
} while( $dir = realpath("$dir/..") );
return null;
}
define( 'BASE_PATH', find_wordpress_base_path()."/" );
define('WP_USE_THEMES', false);
global $wp, $wp_query, $wp_the_query, $wp_rewrite, $wp_did_header;
require(BASE_PATH . 'wp-load.php');
// Set domain and upload directory
$domain = 'https://my_domain';
$upload_dir = '/content_dir/uploads/old_avatars/';
$users = get_users();
foreach( $users as $user ) {
// Build path to avatar
$avatar_url = $upload_dir . str_replace(' ', '-', $user->user_login) . '_avatar.png';
if ( file_exists ( BASE_PATH . $avatar_url ) ) {
// Update user meta data
update_user_meta( $user->ID, 'basic_user_avatar', array( 'full' => $domain . $avatar_url ) );
// Show user meta data from database
$local_avatar = get_user_meta( $user->ID, 'basic_user_avatar', true );
echo '
<pre>' . print_r( $local_avatar, true ) . '</pre>
';
}
}
?>
The only draw back is that when you develop on dev.my_domain.com and want to use the dev database for production when you’re done, you’ll need to replace all domain names in the URLs in your database.
I also had to convert all internal phpBB links (viewtopic.php?f=x&t=x) to the appropriate bbPress URLs. This was quite a difficult job.