getMessage()); } log_print("generating thumbnail for $original_file"); $output = shell_exec(THUMBNAIL_SCRIPT." '$original_file' '$thumbnail_file' 2>&1"); if ($output) log_print($output); if ($output === false) { log_error("Thumbnail failed"); return ROOT_URL.IMG_DIR.$path; } return_thumbnail: return ROOT_URL.THUMBNAIL_DIR.$thumbnail_name; } function add_seperator_ab(string $separator, string $a, string $b): string { if ($a === "") return $b; return $a.$separator.$b; } function is_valid_file_type(string $filename): bool { foreach (FILE_EXTENSIONS as $file_extension) { if (str_ends_with($filename, $file_extension)) return true; } return false; } function is_image_file_type(string $filename): bool { foreach(IMAGE_EXTENSIONS as $file_extension) { if(str_ends_with($filename, $file_extension)) return true; } return false; } main(); ?>