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:
@ -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) {
|
||||
|
Reference in New Issue
Block a user