removed some old code, added some forgotten code, added more specific code for PostgreSQL and readded support for previewing media items (thumbnails) (but there seems to be a problem for video items at the moment)