mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-25 23:43:58 +00:00
fixing bugs
This commit is contained in:
@@ -20,13 +20,10 @@ class ConvertsBase64ToFile
|
||||
* ConvertsBase64ToFile constructor.
|
||||
* @param null|string $path
|
||||
*/
|
||||
public function __construct(?string $path = '')
|
||||
public function __construct(?string $path = 'documents')
|
||||
{
|
||||
$this->path = $path ? $path.'/': '';
|
||||
$this->path = $path;
|
||||
$this->filesInfo = [];
|
||||
|
||||
File::isDirectory(storage_path($this->path)) or
|
||||
File::makeDirectory(storage_path($this->path), 0700, true, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +34,7 @@ class ConvertsBase64ToFile
|
||||
*/
|
||||
public function convert($files = []){
|
||||
foreach ($files as $file) {
|
||||
|
||||
$object = new FileObject($file);
|
||||
$object->getExtension() === 'pdf' ? $this->generatePDF($object) : $this->generateImage($object);
|
||||
|
||||
@@ -101,7 +99,7 @@ class ConvertsBase64ToFile
|
||||
*/
|
||||
private function generateFile(FileObject $file, string $suffix = '') {
|
||||
|
||||
$filePath = $this->path.$file->getFileName().$suffix.'.'.$file->getExtension();
|
||||
$filePath = $this->path.'/'.$file->getFileName().$suffix.'.'.$file->getExtension();
|
||||
|
||||
Storage::disk('documents')->put($filePath, $file->getDecodedData());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user