intelligently limiting the number of pictures