store auto-generated images to the database