Java servlet lets you write some text over the existing image. So you can add on the fly some copyright notice to your images for example. How to use it: a) copy drawtextPackage.jar into WEB-INF/lib directory b) describe Draw text servlet in your web.xml file. You can provide the following parameters: dir - describes a directory for your image files
For example:
<servlet> <servlet-name>DrawText</servlet-name> <servlet-class>com.jsos.image.DrawTextServlet</servlet-class> <init-param> <param-name>dir</param-name> <param-value>c:/orion/default-web-app/images</param-value> </init-param> <init-param> <param-name>width</param-name> <param-value>125</param-value> </init-param> <init-param> <param-name>height</param-name> <param-value>125</param-value> </init-param> <init-param> <param-name>text</param-name> <param-value>(c)My Company</param-value> </init-param> </servlet> You can provide both width and height or just one of them. In this case the second dimension will be changed accordingly. c) describe a mapping for this servlet in web.xml file
<servlet-mapping> <servlet-name>DrawText</servlet-name> <url-pattern>/servlet/DrawText</url-pattern> </servlet-mapping> and now you can use servlet in this form: http://your_host/servlet/DrawText?image_file. E.g.:
<img border="0" alt="Preview" src="http://host/servlet/ImageScale?bigfile.jpg"/> for downloading: servlet: drawtextPackage.jar © Coldbeans Software Comments? See also JSOS - the largest collection of servlets and filters.
|
Also in Coldtags:
|