Skip to:
Content
Pages
Categories
Search
Top
Bottom

API function: Add photo / media to user library


  • sx1001
    Participant

    @sx1001

    Hi,

    I’m searching a API function to use a local server jpg-file / photo from the server from elsewhere (not yet in the wp-content/uploads/ folder) and add it to the foto library of a specific user. I do NOT want to update avatar or cover image, just add it to the users media library.

    By doing so, I do not need to use crop, I just want the API function to move/copy the file to the appropriate media upload folder and create the SQL entries.

    In the whole media-functions.php file, I found only the “bp_media_add” which seems to ADD a foto – but there is no “file” parameter. How can I specify which file I wanna use?

    I also found bp_media_handle_sideload() but it seems to also only be able to use a file uploaded by a Form, i.e. $_FILES[].

    If possible, I’d like to also specify a meta-entry for the foto/attachement so I can later access it via some function / custom sql query (i.e. fetch the HTTP-URL of the image for a specific user id)

    Any ideas?

    Thanks!

  • You must be logged in to reply to this topic.
Skip to toolbar