$loginDb = new Login_model(); $existingUsernames = $loginDb->getAllUsernames(); if (!empty($oprHours)) { $oprHours = $oprHours[0]; } if ($_POST) { /* * For uploading images */ if (isset($_POST['image_type'])) { switch ($_POST['image_type']) { case 'profile': if (is_uploaded_file($_FILES['profile-image']['tmp_name'])) { $thumbnail = file_get_contents($_FILES["profile-image"]["tmp_name"]); } if ($restaurantDb->updateRestaurantThumbnail($resId, $thumbnail)) { $restaurantInfo = $restaurantDb->findRestaurantById($resId); } break; case 'multimedia': if (is_uploaded_file($_FILES['multimedia-image']['tmp_name'])) { $img = file_get_contents($_FILES["multimedia-image"]["tmp_name"]); if ($restaurantDb->updateMultimedia($_POST['multimedia-id'], $img, $resId)) { $restaurantImages = $restaurantDb->getRestaurantImages($resId); $imageCount = count($restaurantImages) >= 4 ? 4 : count($restaurantImages); } } break; case 'menu': if (is_uploaded_file($_FILES['menu-image']['tmp_name'])) { $menu = file_get_contents($_FILES["menu-image"]["tmp_name"]);