apoutchika / MediaBundle

Manage your media for Symfony with ApoutchikaMediaBundle
MIT License
7 stars 3 forks source link

create media from URL in controller #6

Open nog31 opened 7 years ago

nog31 commented 7 years ago

Hello,

I wanted to know if there is a way to create media from an URL given in a controller?

I tried :

$media = new Media; $media->setFile('http://url_of_media/picture.jpg');

AND

$media->setFile(file_get_contents('http://url_of_media/picture.jpg'));

But it just don't work :/

Thank you for your support!

apoutchika commented 7 years ago

Hello,

The setFile don't work with url. Try to get the media in tmp directory with curl, and after use the local path of media.