+ /**
+ * Rebuild the thumbnails for the given image.
+ */
+ public function rebuildThumbnails(string $id)
+ {
+ $image = $this->imageRepo->getById($id);
+ $this->checkImagePermission($image);
+ $this->checkOwnablePermission('image-update', $image);
+
+ new OutOfMemoryHandler(function () {
+ return $this->jsonError(trans('errors.image_thumbnail_memory_limit'));
+ });
+
+ $this->imageResizer->loadGalleryThumbnailsForImage($image, true);
+
+ return response(trans('components.image_rebuild_thumbs_success'));
+ }
+