1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Images: Started refactor of image service

To break it up.
Also added better memory handling to other parts of the app.
This commit is contained in:
Dan Brown
2023-09-30 18:28:42 +01:00
parent 40721433f7
commit 7247e31936
8 changed files with 340 additions and 261 deletions

View File

@ -11,7 +11,6 @@ use BookStack\Uploads\ImageService;
use BookStack\Util\OutOfMemoryHandler;
use Exception;
use Illuminate\Http\Request;
use Illuminate\Validation\ValidationException;
class ImageController extends Controller
{
@ -39,9 +38,6 @@ class ImageController extends Controller
/**
* Update image details.
*
* @throws ImageUploadException
* @throws ValidationException
*/
public function update(Request $request, string $id)
{
@ -75,6 +71,10 @@ class ImageController extends Controller
$this->checkOwnablePermission('image-update', $image);
$file = $request->file('file');
new OutOfMemoryHandler(function () {
return $this->jsonError(trans('errors.image_upload_memory_limit'));
});
try {
$this->imageRepo->updateImageFile($image, $file);
} catch (ImageUploadException $exception) {