public class ImageLinkFilter implements Filter {
/** The template to render for the <img> tag. */
- private static final Template linkTemplate = TemplateParser.parse(new StringReader("<img<%ifnull !class> class=\"<%class|css>\"<%/if> src=\"<%src|html><%if forceDownload>?forcedownload=true<%/if>\" alt=\"<%alt|html>\" title=\"<%title|html>\" width=\"<%width|html>\" height=\"<%height|html>\" style=\"position: relative;<%ifnull ! top>top: <% top|html>;<%/if><%ifnull ! left>left: <% left|html>;<%/if>\"/>"));
+ private static final Template linkTemplate = TemplateParser.parse(new StringReader("<img<%ifnull !class> class=\"<%class|css>\"<%/if> src=\"<%src|html>\" alt=\"<%alt|html>\" title=\"<%title|html>\" width=\"<%width|html>\" height=\"<%height|html>\" style=\"position: relative;<%ifnull ! top>top: <% top|html>;<%/if><%ifnull ! left>left: <% left|html>;<%/if>\"/>"));
/** The core. */
private final Core core;
linkTemplateContext.set("class", imageClass);
if (image.isInserted()) {
linkTemplateContext.set("src", "/" + image.getKey());
- linkTemplateContext.set("forceDownload", true);
} else {
linkTemplateContext.set("src", "getImage.html?image=" + image.getId());
}
String result = String.valueOf(imageLinkFilter.format(templateContext, image, ImmutableMap.<String, Object>of()));
Element imageElement = getSingleElement(result);
assertThat(imageElement.attr("class"), is(""));
- assertThat(imageElement.attr("src"), is("/image-key?forcedownload=true"));
+ assertThat(imageElement.attr("src"), is("/image-key"));
assertThat(imageElement.attr("title"), is("image title"));
assertThat(imageElement.attr("alt"), is("image description"));
assertThat(imageElement.attr("width"), is("640"));
String result = String.valueOf(imageLinkFilter.format(templateContext, "image-id", ImmutableMap.<String, Object>of()));
Element imageElement = getSingleElement(result);
assertThat(imageElement.attr("class"), is(""));
- assertThat(imageElement.attr("src"), is("/image-key?forcedownload=true"));
+ assertThat(imageElement.attr("src"), is("/image-key"));
assertThat(imageElement.attr("title"), is("image title"));
assertThat(imageElement.attr("alt"), is("image description"));
assertThat(imageElement.attr("width"), is("640"));