Jump to content

Updating a user profile picture from the API


renobird
 Share

Recommended Posts

Hello All,

I've be able to successfully view and edit user profile info from the API. (I can't believe how simple it is actually.)

I'm a little stuck on how to update a users profile picture.

I have an image field name "images", and I can pull that image and display it.

I'm just not sure how to process a replacement image if one is chosen in the <input type="file" name="images" /> field.

Any pointers would be much appreciated.

Link to comment
Share on other sites

There ain't any plug-in functionality for this (at least yet). What you need to do is to save image to your server (and make sure it is an image and not some script) and then replace the current image with that new one.

So basically it is just regular php file upload and some API stuff afterwards.

If you have multiple images:

$p->images->add("path-to-image"); //Adds new image to Pageimages

This is just a guess, but if images is actually "image" and only single file allowed:

$p->images->filename = "path-to-image";

(might be that the first one works in this situation too and this doesn't)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...