I would like to get an image from REST API by using file_get_content()
and store in Symfony2.
$image = file_get_contents('https://foobar, false, $context)
But I am stacked when I am trying to sage the file.
$image->move($app['config']['image_temp_realdir'], $filename);
This line cause "Error: Call to a member function move() on string".
I understand this file data is not a File entity, but how can I convert this into File Entity? Or any method I can use to get file instead of file_get_content()
?
Thanks in advance to your help.
Sorry, the problem resolved.
Saved the file by
file_put_contents()
and created new File.file_put_contents($app['config']['image_temp_realdir'].'/'.$filename, $image); $file = new File($app['config']['image_temp_realdir'].'/'.$filename);