Warning: opendir(./img): Failed to open directory: No such file or directory in /var/task/user/index.php on line 30

Fatal error: Uncaught TypeError: readdir(): Argument #1 ($dir_handle) must be of type resource or null, false given in /var/task/user/index.php:32 Stack trace: #0 /var/task/user/index.php(32): readdir(false) #1 /var/task/user/index.php(43): getfilecounts('img') #2 /var/task/user/index.php(24): getRandomfile('img') #3 /var/task/user/api/index.php(10): require_once('/var/task/user/...') #4 {main} thrown in /var/task/user/index.php on line 32