mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
fixing bugs
This commit is contained in:
@@ -20,13 +20,10 @@ class ConvertsBase64ToFile
|
|||||||
* ConvertsBase64ToFile constructor.
|
* ConvertsBase64ToFile constructor.
|
||||||
* @param null|string $path
|
* @param null|string $path
|
||||||
*/
|
*/
|
||||||
public function __construct(?string $path = '')
|
public function __construct(?string $path = 'documents')
|
||||||
{
|
{
|
||||||
$this->path = $path ? $path.'/': '';
|
$this->path = $path;
|
||||||
$this->filesInfo = [];
|
$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 = []){
|
public function convert($files = []){
|
||||||
foreach ($files as $file) {
|
foreach ($files as $file) {
|
||||||
|
|
||||||
$object = new FileObject($file);
|
$object = new FileObject($file);
|
||||||
$object->getExtension() === 'pdf' ? $this->generatePDF($object) : $this->generateImage($object);
|
$object->getExtension() === 'pdf' ? $this->generatePDF($object) : $this->generateImage($object);
|
||||||
|
|
||||||
@@ -101,7 +99,7 @@ class ConvertsBase64ToFile
|
|||||||
*/
|
*/
|
||||||
private function generateFile(FileObject $file, string $suffix = '') {
|
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());
|
Storage::disk('documents')->put($filePath, $file->getDecodedData());
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ require_once "vendor/autoload.php";
|
|||||||
// If you have modified your font directory set this
|
// If you have modified your font directory set this
|
||||||
// variable appropriately.
|
// variable appropriately.
|
||||||
//$fontDir = "lib/fonts";
|
//$fontDir = "lib/fonts";
|
||||||
|
$fontDir = 'storage/fonts';
|
||||||
|
|
||||||
// *** DO NOT MODIFY BELOW THIS POINT ***
|
// *** DO NOT MODIFY BELOW THIS POINT ***
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
errorHandler(error, statusCode){
|
errorHandler(error, statusCode){
|
||||||
this.src = statusCode === 404 ? 'images/3231370.jpg' : 'images/2942005.jpg'
|
this.src = statusCode === 404 ? '/images/3231370.jpg' : '/images/2942005.jpg'
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user