Update avatar image
- 
		Hi to all, i’m creating a custom backend API to update a user avatar image via user id. So i send via post REST request this parameters: 
 – user_id : the id of the user;
 – image: base64 image;
 – image_name: the image name.
 This is the php code that i use to update the avatar image but it doesn’t works 🙁
 // Get URL data
 global $json_api
 $user_id = $json_api->query->user_id;
 $image = $json_api->query->image;
 $image_name = $json_api->query->image_name;
 $image = str_replace('data:image/jpeg;base64,', '', $image);
 $image = str_replace(' ', '+', $image);
 $hashed_filename = md5( $image_name . microtime() ) . '_bpthumb.jpg';
 $data = base64_decode($image);
 $success = file_put_contents('/wp-content/uploads/avatars/'.$user_id.'/'.$hashed_filename, $data);
 $success variable returns always false T.T 
 Thank you in advance for the help and sorry for my english.
- You must be logged in to reply to this topic.