mirror of
https://github.com/BookStackApp/BookStack.git
synced 2024-08-27 20:51:57 +00:00
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.
This commit is contained in:
parent
0c9c1e4c6b
commit
8c4c8cd95b
@ -114,16 +114,16 @@ class ImageService extends UploadService
|
|||||||
$secureUploads = setting('app-secure-images');
|
$secureUploads = setting('app-secure-images');
|
||||||
$imageName = str_replace(' ', '-', $imageName);
|
$imageName = str_replace(' ', '-', $imageName);
|
||||||
|
|
||||||
if ($secureUploads) {
|
|
||||||
$imageName = str_random(16) . '-' . $imageName;
|
|
||||||
}
|
|
||||||
|
|
||||||
$imagePath = '/uploads/images/' . $type . '/' . Date('Y-m-M') . '/';
|
$imagePath = '/uploads/images/' . $type . '/' . Date('Y-m-M') . '/';
|
||||||
|
|
||||||
while ($storage->exists($imagePath . $imageName)) {
|
while ($storage->exists($imagePath . $imageName)) {
|
||||||
$imageName = str_random(3) . $imageName;
|
$imageName = str_random(3) . $imageName;
|
||||||
}
|
}
|
||||||
|
|
||||||
$fullPath = $imagePath . $imageName;
|
$fullPath = $imagePath . $imageName;
|
||||||
|
if ($secureUploads) {
|
||||||
|
$fullPath = $imagePath . str_random(16) . '-' . $imageName;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$storage->put($fullPath, $imageData);
|
$storage->put($fullPath, $imageData);
|
||||||
|
@ -547,7 +547,7 @@ class WysiwygEditor {
|
|||||||
html += `<img src="${image.thumbs.display}" alt="${image.name}">`;
|
html += `<img src="${image.thumbs.display}" alt="${image.name}">`;
|
||||||
html += '</a>';
|
html += '</a>';
|
||||||
editor.execCommand('mceInsertContent', false, html);
|
editor.execCommand('mceInsertContent', false, html);
|
||||||
});
|
}, 'gallery');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user