Fileupload - Error divison by zero
I use the following code for fileupload customization, but when I use Livewire\Features\SupportFileUploads\TemporaryUploadedFile I get a "divison by zero" error.
FileUpload::make('avatar')
->label('Avatar Upload')
->disk('s3')
->image()
->visibility('private')
->maxSize(1024)
->preserveFilenames()
->imageResizeTargetHeight(600)
->getUploadedFileNameForStorageUsing(function (TemporaryUploadedFile $file): string {
// store new file
$oriName = $file->getClientOriginalName();
$storeName = $file->getFilename();
$this->userAvatar = [
'user_id' => auth()->ufile()->id,
'file_name' => $oriName,
'file_path' => auth()->ufile()->filePath() . '/' . $storeName,
'is_public' => false,
'categories' => ['Avatar'],
'upload' => ['Avatar'],
];
return (string) str($file->getFilename());
})
->directory(auth()->ufile()->filePath()),
1 Reply
Found the problem. When I use ->imageResizeTargetHeight() maybe a bug?