L
L
lolrofl012018-06-07 13:08:46
Laravel
lolrofl01, 2018-06-07 13:08:46

What is the easiest way to save an image from a link in laravel?

Hello.
There is a link to an image. It is necessary that the picture is loaded using this link, its name is changed and it is saved in the desired folder. In the documentation, I saw only about saving pictures transmitted through the form. And I saw that there are many packages ready to help me in this situation. Is there a solution in Laravel without packages, but standard out of the box?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Lander, 2018-06-07
@lolrofl01

copy('http://site.ru/images/cool.jpg', '/path/to/saved/file.jpg');

A
Alexander Aksentiev, 2018-06-07
@Sanasol

Is there a solution in laravel without packages

in php, probably, laravel has something to do with it if there is everything for this in the language itself?
file_get_contents
file_put_contents (well, or already the Storage facade in Laravel)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question