write a script to automatically generate thumbnails without blocking upload request