* the languages to build the previews for
*/
protected void createPreviews(final Resource<?> resource,
Language... languages) {
ResourceURI uri = resource.getURI();
// Compile the full list of image styles
if (imageStyleTracker == null) {
logger.info("Skipping preview generation for {}: image styles are unavailable", uri);
return;
}
final List<ImageStyle> previewStyles = new ArrayList<ImageStyle>();
// Add the global image styles that have the preview flag turned on
for (ImageStyle s : imageStyleTracker.getImageStyles()) {
if (s.createPreview(resource.getURI().getType())) {
previewStyles.add(s);
logger.debug("Preview images will be generated for {}", s);
} else {
logger.debug("Preview image generation will be skipped for {}", s);
}
}
// Add the site's preview image styles as well as
for (Module m : getSite().getModules()) {
for (ImageStyle s : m.getImageStyles()) {
if (s.createPreview(resource.getURI().getType())) {
previewStyles.add(s);
logger.debug("Preview images will be generated for {}", s);
} else {
logger.debug("Preview image generation will be skipped for {}", s);
}
}
}
// If no language has been specified, we create the preview for all
// languages
if (languages == null || languages.length == 0) {
languages = uri.getSite().getLanguages();
}
// Create the previews
PreviewOperation previewOp = null;
synchronized (currentPreviewOperations) {