I'm reading an image from my S3 bucket in AWS and want to upload it to Facebook.
This is the reading function:
/**
* Get a file from the s3 storage
*/
private function uploadPicture() {
$picture = new FacebookPicture();
$file = $this->s3Manager->getFile($this->subEndPoint,$this->verb);
$picture->pictureContent = $file["Body"];
$facebookAlbum = new FacebookAlbum();
$facebookAlbum->album = new Album();
$facebookAlbum->album->facebookAccessToken = "myAccessToken";
$facebookAlbum->id = "myAlbumId";
$facebookManager = new FacebookManager();
$facebookManager->uploadPicture($facebookAlbum,$picture);
}
This is the uploading to Facebook function
/**
* @param $facebookAlbum FacebookAlbum the album to upload the picture to
* @param $picture FacebookPicture the picture to upload
*/
public function uploadPicture($facebookAlbum,$picture)
{
$this->facebook->setAccessToken($facebookAlbum->album->facebookAccessToken);
$this->facebook->setFileUploadSupport(true);
$args = array();
$args["message"] = $picture->description;
$args["source"] = "@" . $picture->pictureContent;
$data = $this->facebook->api('/'. $facebookAlbum->id . '/photos', 'post', $args);
var_dump($data);
}
I keep getting :
curl_setopt_array(): The usage of the @filename API for file uploading is deprecated. Please use the CURLFile class instead in <b>acebook-php-sdk-master/src/base_facebook.php</b> on line <b>1005</b><br />
I think that the problem is that the image content is saved in the memory.
How can I use the variable in my memory in order to post it to Facebook ?
Aucun commentaire:
Enregistrer un commentaire