Skip to content

Commit 2576e77

Browse files
committed
fix upload save
1 parent 81746cd commit 2576e77

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/LfmPath.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace UniSharp\LaravelFilemanager;
44

5+
use Illuminate\Http\File;
56
use Illuminate\Container\Container;
67
use Intervention\Image\Facades\Image;
78
use Symfony\Component\HttpFoundation\File\UploadedFile;
@@ -299,7 +300,7 @@ private function getNewName($file)
299300

300301
private function saveFile($file, $new_file_name)
301302
{
302-
$this->setName($new_file_name)->storage->save(file_get_contents($file));
303+
$this->setName($new_file_name)->storage->save($file);
303304

304305
$this->makeThumbnail($new_file_name);
305306

@@ -318,10 +319,13 @@ public function makeThumbnail($file_name)
318319
$this->setName(null)->thumb(true)->createFolder();
319320

320321
// generate cropped image content
321-
$image_content = Image::make($original_image->get())
322+
$image_path = $this->setName($file_name)->thumb(true)->path('absolute');
323+
$image = Image::make($original_image->get())
322324
->fit(config('lfm.thumb_img_width', 200), config('lfm.thumb_img_height', 200))
323-
->encode();
325+
->save($image_path);
324326

325-
$this->setName($file_name)->thumb(true)->storage->save((string) $image_content);
327+
$file = new File($image_path);
328+
329+
$this->setName($file_name)->thumb(true)->storage->save($file);
326330
}
327331
}

0 commit comments

Comments
 (0)