SQL based image management solution