* ch.entwine.weblounge.common.language.Language)
*/
public Resource<ImageContent> newResource(Site site, InputStream is,
User user, Language language) {
ImageMetadata imageMetadata = ImageMetadataUtils.extractMetadata(new BufferedInputStream(is));
ImageResource imageResource = new ImageResourceImpl(new ImageResourceURIImpl(site));
imageResource.setCreated(user, new Date());
if (imageMetadata == null)
return imageResource;
if (!StringUtils.isBlank(imageMetadata.getCaption())) {
imageResource.setTitle(imageMetadata.getCaption(), language);
}
if (!StringUtils.isBlank(imageMetadata.getLegend())) {
imageResource.setDescription(imageMetadata.getLegend(), language);
}
for (String keyword : imageMetadata.getKeywords()) {
imageResource.addSubject(keyword);
}
if (!StringUtils.isBlank(imageMetadata.getCopyright())) {
imageResource.setRights(imageMetadata.getCopyright(), language);
}
return imageResource;
}