I try to make image fixtures using a library online => with the response i want to upload the photo into a field.
I use Symfony 3.4 with the environment php7.1. I have alreagy make the request to the libraty online, with the response Iwant to use it to upload the image.
My Controller
/**
* @Route("/", name="homepage")
*/
public function indexAction(Request $request)
{
$requestManager = $this->get('request_manager');
$data = $requestManager->sendRequest('https://source.unsplash.com/100x100/?usa');
die;
}
}
I want to use the response data to put it into a UploadedFile, why ? in order to use it to upload my file with vich ... for exemple I will do something like that:
$entity = new Person();
$entity->setAvatarFile($dataUploadedFile)
Actually I can't put the data into a new uploadedFile() because the response binary ... I really don't know if it possible ... ut if it's possible it could be crazy as f*k :D. I want do that to make some fixtures for each entity which need an image ... Thanks for any Help.
Sorry for my bad english :).