From bd162f5ecb541417ce479850a31e05b785e576a3 Mon Sep 17 00:00:00 2001 From: Timot Tarjani Date: Wed, 17 Apr 2024 10:32:44 +0200 Subject: [PATCH] Fix UploadsImage trait ensure path --- app/Controllers/Trait/UploadsImage.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Controllers/Trait/UploadsImage.php b/app/Controllers/Trait/UploadsImage.php index b341ef527..fb42af046 100644 --- a/app/Controllers/Trait/UploadsImage.php +++ b/app/Controllers/Trait/UploadsImage.php @@ -21,11 +21,11 @@ public function uploadImage($model): bool { if (request()->hasFile($this->form_field_name)) { - File::ensureDirectoryExists($this->getStrippedDirectoryPath($model)); + File::ensureDirectoryExists($model->getImageDirectory()); $img = request()->{$this->form_field_name}->store($this->getStrippedDirectoryPath($model)); $model->attachImage($img); if (extension_loaded('gd')) { - File::ensureDirectoryExists($this->getStrippedDirectoryPath($model) . '/thumbs'); + File::ensureDirectoryExists($model->getImageDirectory() . '/thumbs'); \Intervention\Image\ImageManagerStatic::make(storage_path($img))->fit(300, 200)->save($model->getThumbnailDirectory(). DIRECTORY_SEPARATOR . $model->image); }