Skip to content

Commit efe5b2b

Browse files
committed
e
1 parent 839e4ad commit efe5b2b

File tree

2 files changed

+27
-42
lines changed

2 files changed

+27
-42
lines changed

src/Services/AttachmentService.php

+27-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function upload($file, $path)
6666

6767
$fileName = now()->timestamp . '-' . $file->getClientOriginalName();
6868

69-
// $this->mkdir_if_not_exists($destinationPath);
69+
// $this->mkdir_if_not_exists($destinationPath);
7070

7171
//$this->disk()->put();
7272
$this->disk()->putFileAs($destinationPath, $file, $fileName);
@@ -83,7 +83,7 @@ function mkdir_if_not_exists($dirPath)
8383

8484
public function uploadImage(UploadedFile $uploadedFile, $path = null)
8585
{
86-
// $image = Image::make($uploadedFile->getRealPath());
86+
// $image = Image::make($uploadedFile->getRealPath());
8787
}
8888

8989
public function isFile($file): bool
@@ -96,4 +96,29 @@ public function isImage($file): bool
9696
return true;
9797
}
9898

99+
public function attachFromUrl($url, array $options = null)
100+
{
101+
# code...
102+
}
103+
104+
public function attachFromStream($stream, $filename, $disk = null)
105+
{
106+
if ($stream === null) {
107+
return null;
108+
}
109+
110+
$this->disk = $this->disk ?: ($disk ?: Storage::getDefaultDriver());
111+
112+
$driver = Storage::disk($this->disk);
113+
114+
$this->filename = $filename;
115+
$this->filepath = $this->filepath ?: ($this->getStorageDirectory() . $this->getPartitionDirectory() . $this->getDiskName());
116+
117+
$driver->putStream($this->filepath, $stream);
118+
119+
$this->filesize = $driver->size($this->filepath);
120+
$this->filetype = $driver->mimeType($this->filepath);
121+
122+
return $this;
123+
}
99124
}

src/Services/mt.php

-40
This file was deleted.

0 commit comments

Comments
 (0)