only use one row per referenced image (for performance)