Hi clarkwinkelmann with help from @luceos this is the current version which still doesn't work
static private function updateAvatar( $id, $file )
{
$finfo = pathinfo( $file );
$fext = $finfo['extension'];
$path = jDI::getInstance()->get( 'Config' )['forum']['url'] . "/api/users/{$id}/avatar";
$ch = curl_init( $path );
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, file_get_contents( $file ) );
curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Token ' . jDI::getInstance()->get( 'Config' )['forum']['apiKey'] . '; userId=1',
"Content-Disposition: form-data; name=\"avatar\"; filename=\"{$file}\"",
"Content-Type: image/{$fext}" ] );
if( ! $result = curl_exec( $ch ) )
{
throw new \Exception( "curl error: " . curl_error( $ch ) );
}
curl_close( $ch );
jDI::getInstance()->get( 'Log' )->debug( "Updated Avatar user({$id}) {$file}" );
}
obviously some of that is from my settings/config