User Service Module - Upload/Change User Picture

Events happening in the community are now at Drupal community events on www.drupal.org.
pajoh's picture

I am using Flex 2.0 and AMFPHP to access Drupal user services, and it has been going pretty smoothly. I've managed to create a couple simple user services on my own.

However, I am currently attempting to expand the user service module to allow uploading / changing the user picture. I am have more difficulty with this.

The following is my first stab at this and it doesn't work. I am hoping someone could point me in the right direction! Thanks!

function user_service_image( $source ) {

    $info = image_get_info($source);
   $file = file_check_upload( $source );

if ($file){

       $filepath   = variable_get('user_picture_path', 'pictures') .'/picture-'. $user->uid .'.'. $info['extension'];
        $file       = file_save_upload($file, $filepath, 1);

      $user       = array( 'picture' => $filepath );         
              $result     = user_save('', $user);

             return $file;
  }

}

Comments

Update

publishr's picture

I am looking for this tool also. Any luck getting it to work? Let me know by email - publisher at qctonline.com

proof of concept

attiks's picture

I created a wiki page (http://groups.drupal.org/node/13781) with a proof of concept for file upload using flash 8 / drupal 6.

Services

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week