Pupulate thumbnails

Raw data contains thumbnails. This patch makes it possible to create
pictures from those thumbnails, and also sets up a relation between
them.