From 8c4c8cd95b97f4a1a0d4a831673d50982c53e305 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Sun, 20 May 2018 16:47:53 +0100 Subject: [PATCH] Updated secure-images option to not effect image name Instead only the image path is altered. Also fixed image manger mode not changing on button press. --- app/Services/ImageService.php | 8 ++++---- resources/assets/js/components/wysiwyg-editor.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Services/ImageService.php b/app/Services/ImageService.php index 736b30705..c087c1e03 100644 --- a/app/Services/ImageService.php +++ b/app/Services/ImageService.php @@ -114,16 +114,16 @@ class ImageService extends UploadService $secureUploads = setting('app-secure-images'); $imageName = str_replace(' ', '-', $imageName); - if ($secureUploads) { - $imageName = str_random(16) . '-' . $imageName; - } - $imagePath = '/uploads/images/' . $type . '/' . Date('Y-m-M') . '/'; while ($storage->exists($imagePath . $imageName)) { $imageName = str_random(3) . $imageName; } + $fullPath = $imagePath . $imageName; + if ($secureUploads) { + $fullPath = $imagePath . str_random(16) . '-' . $imageName; + } try { $storage->put($fullPath, $imageData); diff --git a/resources/assets/js/components/wysiwyg-editor.js b/resources/assets/js/components/wysiwyg-editor.js index 764b0a929..72263e2f2 100644 --- a/resources/assets/js/components/wysiwyg-editor.js +++ b/resources/assets/js/components/wysiwyg-editor.js @@ -547,7 +547,7 @@ class WysiwygEditor { html += `${image.name}`; html += ''; editor.execCommand('mceInsertContent', false, html); - }); + }, 'gallery'); } });