php - Saving a remote image from facebook graph api -
any idea what's wrong? end 1bytes files , wrong. using intervention image & php. tried many ways nothing... if want display works can't save picture...
$avatar_url = 'http://graph.facebook.com/' . $id . '/picture?type=square&width=140&height=140&redirect=false'; $avatar_pic_url = json_decode(file_get_contents($avatar_url), true)['data']['url']; dd($avatar_pic_url); $avatar = image::make($avatar_pic_url); $extension = 'jpg'; // save $destinationpath = 'uploads/avatars/'; $filename = uniqid(). '.' . $extension; $path_to_temp_image = $avatar->dirname . '/' . $avatar->filename; $key = $destinationpath . $filename; // upload avatar remote storage $uploadsuccess = storage::put($key, $path_to_temp_image);
Comments
Post a Comment