I am new to the Facebook Marketing API and what I am working on is to upload an image to my FB Marketing library.
Right now, I can successfully upload an image to the FB Marketing but unfortunately I cannot see if there is a way to upload an image from a URL.
Has anyone had any previous experience with that ?
Code sample:
Api::init(getenv('FACEBOOK_APP_ID'), getenv('FACEBOOK_APP_SECRET'), getenv('FACEBOOK_APP_TOKEN'));
/**
* {@inheritdoc}
*/
public function testFunc()
{
$adAccountId = getenv('FACEBOOK_APP_ACCOUNT_ID');
$account = new AdAccount();
$account->{AdAccountFields::ID} = $adAccountId;
$image = new AdImage(null, "act_{$account->id}");
$image->{AdImageFields::FILENAME} = getenv('FACEBOOK_APP_MARKETING_PATH').'fbTestImage.png';
$image->create();
$this->line('Image Hash: '.$image->{AdImageFields::HASH}.PHP_EOL);
}