caching image alternatives in db