query images first