Skip to content

Commit

Permalink
Fix UploadsImage trait ensure path
Browse files Browse the repository at this point in the history
  • Loading branch information
Timot Tarjani committed Apr 17, 2024
1 parent 85c0308 commit bd162f5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/Controllers/Trait/UploadsImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit bd162f5

Please sign in to comment.