stream thumbnail for jpg and png… bad code, need refactor