Skip to content

Commit db45c30

Browse files
authored
Fix adding/updating a seating plan with no image URL
1 parent d2394a4 commit db45c30

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

app/Http/Controllers/Admin/SeatingPlanController.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,14 @@ protected function updateObject(SeatingPlan $plan, Request $request)
3535
{
3636
$plan->name = $request->input('name');
3737
$plan->image_url = $request->input('image_url');
38-
$imageSizeArr = getimagesize($request->input('image_url'));
39-
if($imageSizeArr) {
40-
$plan->image_height = $imageSizeArr[1];
41-
$plan->image_width = $imageSizeArr[0];
38+
$plan->image_height = null;
39+
$plan->image_width = null;
40+
if ($plan->image_url) {
41+
$imageSizeArr = getimagesize($request->input('image_url'));
42+
if ($imageSizeArr) {
43+
$plan->image_height = $imageSizeArr[1];
44+
$plan->image_width = $imageSizeArr[0];
45+
}
4246
}
4347
$plan->scale = $request->input('scale') ? $request->input('scale') : 100;
4448
$plan->save();

0 commit comments

Comments
 (0)