use BookStack\Exceptions\ImageUploadException;
use BookStack\Uploads\ImageRepo;
+use Exception;
use Illuminate\Http\Request;
use BookStack\Http\Controllers\Controller;
{
protected $imageRepo;
- /**
- * DrawioImageController constructor.
- * @param ImageRepo $imageRepo
- */
public function __construct(ImageRepo $imageRepo)
{
$this->imageRepo = $imageRepo;
/**
* Get a list of gallery images, in a list.
* Can be paged and filtered by entity.
- * @param Request $request
- * @return \Illuminate\Http\JsonResponse
*/
public function list(Request $request)
{
$parentTypeFilter = $request->get('filter_type', null);
$imgData = $this->imageRepo->getEntityFiltered('drawio', $parentTypeFilter, $page, 24, $uploadedToFilter, $searchTerm);
- return response()->json($imgData);
+ return view('components.image-manager-list', [
+ 'images' => $imgData['images'],
+ 'hasMore' => $imgData['has_more'],
+ ]);
}
/**
* Store a new gallery image in the system.
- * @param Request $request
- * @return Illuminate\Http\JsonResponse
- * @throws \Exception
+ * @throws Exception
*/
public function create(Request $request)
{
/**
* Get the content of an image based64 encoded.
- * @param $id
- * @return \Illuminate\Http\JsonResponse|mixed
*/
public function getAsBase64($id)
{
if ($imageData === null) {
return $this->jsonError("Image data could not be found");
}
+
return response()->json([
'content' => base64_encode($imageData)
]);