moved resizing to db function