I noticed this problem in a cpg installation with large number of photos.
Functions getfoldercontent and display_dir_tree may timeout.
As all the users are not able to change their PHP configuration (php.ini),
maybe you should consider adding
set_time_limit(0);
to start of those functions.