Skip to content

Commit

Permalink
✨ Add Some Function
Browse files Browse the repository at this point in the history
  • Loading branch information
LaravelChen committed Aug 3, 2017
1 parent a1ce30d commit 4518b66
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 8 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,12 @@
"src/helper.php"
]
}
"extra": {
"laravel": {
"providers": [
" LaravelChen\\Editormd\\EditorMdProvider",
"zgldh\\QiniuStorage\\QiniuFilesystemServiceProvider"
]
}
}
}
7 changes: 4 additions & 3 deletions src/Controllers/EditormdController.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ public function uploadimage(Request $request)
if (in_array($ext, ['png', 'jpg', 'jpeg', 'gif'])) {
if (config("editormd.upload_type") === 'qiniu') {
$disk = QiniuStorage::disk('qiniu');
$disk->put(basename($savepath), file_get_contents($file));
$realpath= $savepath . '/' . uniqid() . '_' . date('s') . '.' . $ext;
$disk->put(basename($realpath), file_get_contents($file));
if (config("editormd.upload_http") === 'https') {
$realurl = $disk->downloadUrl(basename($savepath), 'https');
$realurl = $disk->downloadUrl(basename($realpath), 'https');
} else {
$realurl = $disk->downloadUrl(basename($savepath));
$realurl = $disk->downloadUrl(basename($realpath));
}
$json = array_replace($json, ['success' => 1, 'url' => $realurl]);
} else {
Expand Down

0 comments on commit 4518b66

Please sign in to comment.