I'm currently writing a method in Laravel to download the Facebook avatar over HTTP (using Intervention Image) and storing it in the storage_path() folder of Laravel, however when using third-party tools like Intervention, they don't detect and follow the same path conventions as Laravel does - especially in regards to the /storage/app/public/... directory.
What would be a cleaner way to do the below? (which works fine, but isn't very pretty)
$filename = uniqid().'.jpg';
$system_filename = 'public/avatars/'.$filename;
$public_filename = 'storage/avatars/'.$filename;
Storage::makeDirectory('public/avatars');
$image = Image::make($fullAvatarPath);
if($image->mime() === "image/jpeg")
{
$image->save(storage_path('app/'.$system_filename));
}
$this->update([
'image' => asset($public_filename)
]);
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2FrCkPZ
via IFTTT
Aucun commentaire:
Enregistrer un commentaire