improve image management from db