diff --git a/app/Jobs/SaveProfileImage.php b/app/Jobs/SaveProfileImage.php index 44073f23..cf2197e3 100644 --- a/app/Jobs/SaveProfileImage.php +++ b/app/Jobs/SaveProfileImage.php @@ -10,6 +10,7 @@ use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; use Illuminate\Queue\InteractsWithQueue; use Illuminate\Queue\SerializesModels; +use Illuminate\Support\Arr; use Jonnybarnes\WebmentionsParser\Authorship; use Jonnybarnes\WebmentionsParser\Exceptions\AuthorshipParserException; @@ -19,8 +20,7 @@ class SaveProfileImage implements ShouldQueue use Queueable; use SerializesModels; - /** @var array */ - protected $microformats; + protected array $microformats; /** * Create a new job instance. @@ -44,17 +44,18 @@ class SaveProfileImage implements ShouldQueue } catch (AuthorshipParserException $e) { return; } - $photo = $author['properties']['photo'][0]; - $home = $author['properties']['url'][0]; + $photo = Arr::get($author, 'properties.photo.0'); + $home = Arr::get($author, 'properties.url.0'); //dont save pbs.twimg.com links if ( - parse_url($photo, PHP_URL_HOST) != 'pbs.twimg.com' + $photo + && parse_url($photo, PHP_URL_HOST) != 'pbs.twimg.com' && parse_url($photo, PHP_URL_HOST) != 'twitter.com' ) { $client = resolve(Client::class); try { $response = $client->get($photo); - $image = $response->getBody(true); + $image = $response->getBody(); } catch (RequestException $e) { // we are opening and reading the default image so that $default = public_path() . '/assets/profile-images/default-image';