Open geoff-maddock opened 1 year ago
This code is checking if the 'media' file is readable and if it can get the file contents.
Need to confirm what the path is. This should work because it works with the manual run, but maybe there's something in the command environment that is missing?
Seems like it must have to do with the path where the primary photo is stored by EventPublished::toTwitter in order to make it uploadable to twitter:
/**
* @param Notifiable $notifiable
*/
/** @phpstan-ignore-next-line */
public function toTwitter($notifiable): TwitterStatusUpdate
{
if ($photo = $notifiable->getPrimaryPhoto()) {
// copy the file to local
$temp = Storage::disk('external')->get($photo->getTwitterPath());
$public = Storage::disk('public');
$public->put('./photos/temp/'.$photo->name, $temp);
return (new TwitterStatusUpdate($notifiable->getBriefFormat()))->withImage('storage/photos/temp/'.$photo->name);
}
return new TwitterStatusUpdate($notifiable->getBriefFormat());
}
Why would this be different in a command than when run from an HTTP route handler?
This is not going to work currently because my Twitter API account is suspended.
[2023-05-12 07:00:05] local.ERROR: You must supply a readable file {"exception":"[object] (InvalidArgumentException(code: 0): You must supply a readable file at /var/www/events-tracker/vendor/abraham/twitteroauth/src/TwitterOAuth.php:343)