This commit is contained in:
Kekskurse 2021-01-17 03:07:52 +01:00
parent ac515118f5
commit 5f5282e9b6

View file

@ -42,16 +42,16 @@ class PublicController extends BaseController
return view("themes.gallery.gallery.list", ["gallery" => $gallery, "tenant" => $tenant, "images" => $images]);
}
public function returnImageFile($tenant, $gallery, $image, Request $request) {
public function returnImageFile($tenant_url, $gallery_url, $image_id, Request $request) {
$sizeName = $request->input("size", "medium");
if(!array_key_exists($sizeName, $this->size)) {
abort(400, "Size not exists");
}
$size = $this->size[$sizeName];
$image = Image::query()->where("id", "=", $image)->firstOrFail();
$gallery = Gallery::query()->where("id", "=", $gallery)->firstOrFail();
$tenant = Tenant::query()->where("id", "=", $tenant)->firstOrFail();
$image = Image::query()->where("id", "=", $image_id)->firstOrFail();
$gallery = Gallery::query()->where("url", "=", $gallery_url)->firstOrFail();
$tenant = Tenant::query()->where("url", "=", $tenant_url)->firstOrFail();
if($gallery != $gallery->url) {
abort(404, "Gallery not match");
}