Support the ongoing development of Laravel.io →
Database Laravel
Last updated 10 months ago.
0
moderator Solution

Hey!

The easiest way to do this would be somethink like this:

// Download image - this does not handle 404 or other webserver errors
$imageContent = file_get_contents($url);

\Illuminate\Support\Facades\Storage::disk('public')->put($image, $imageContent);

You can put that code right below $image = $id.'.jpg'; in your code.

1
Solution selected by @renaldyks

Sign in to participate in this thread!

LaraJobs

Your banner here too?

Kev renaldyks Joined 19 Oct 2021

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2023 Laravel.io - All rights reserved.