if (uri == null && StringUtils.isNotBlank(imagePath))
uri = new ImageResourceURIImpl(site, imagePath, null);
if (uri == null && imageSubjects != null && imageSubjects.size() > 0) {
SearchQuery query = new SearchQueryImpl(site);
query.withVersion(Resource.LIVE);
query.withTypes(ImageResource.TYPE);
query.withSubjects(SearchQuery.Quantifier.All, imageSubjects.toArray(new String[imageSubjects.size()]));
SearchResult result;
try {
result = repository.find(query);
} catch (ContentRepositoryException e) {