本文档是您了解图形转换服务的起始点。包括下列主题:
图形转换服务提供服务器端 JAX-RS 资源,该资源支持多种图形格式之间的缩放和转换。请参阅转换图表以获取详细信息。
从/至 | GIF | JPEG | PNG | TIFF | GFX | |
---|---|---|---|---|---|---|
GIF | 是 | 是 [1] | 否 | 是 [1] | 否 | 否 |
JPEG | 是 [1] | 是 | 否 | 是 | 否 | 否 |
--- | --- | --- | --- | --- | --- | |
PNG | 是 [1] | 是 | 否 | 是 | 否 | 否 |
SVG | 否 | 是 | 是 | 是 | 是 | 是 [2] |
TIFF | --- | --- | --- | --- | --- | --- |
[1] 仅在 Java SDK V6.0 或更高版本的情况下受支持。
[2] 当前在 SVG 至 GFX 功能的作用域中存在限制。请参阅限制一节。
通过移动展示样本提供了样本客户机应用程序,该应用程序说明了图形转换服务的简单 Ajax 调用。WAS 8.5 样本信息中心中提供了移动展示样本。
产品先决条件 | 版本 |
---|---|
Java Technology Edition | 5.0 及更高版本 |
|
WebSphere Application Server V8.5r |
Web 浏览器 | 任何现代 Web 浏览器,如:Internet Explorer 7 及更高版本、Mozilla Firefox 3.x 及更高版本、Google Chrome、Safari 和 Opera |
要使用图形转换服务,请将该服务 .ear 文件部署至应用程序服务器。请阅读有关安装图形转换服务的信息。
部署该服务后,可以使用提供的客户机演示。以下地址提供了该演示:
http://<server>:<port>/appsvcs-graphics/
在各个输入字段中尝试不同的值,以查看转换后的图像。
要直接在浏览器中生成动态图像转换,还可以输入带有您指定的参数的 URL;例如:
http://<server>:<port>/appsvcs-graphics/rest/graphics/convert/binaryResponse?sourceUrl=<graphic_file_url>&desiredFormat=<new_format>&maxWidth=<optional_width>&maxHeight=<optional_height>
请注意,通过 URL 引用返回的工作文件和转换后的文件将存储在由 resultsTmpDir 配置参数指定的临时目录位置中,该参数在 web.xml 文件的 initialization 参数中声明。web.xml 文件的以下部分说明了此参数的使用:
... <init-param> <!-- Set the following property to the full path where you want newly scaled and converted images to be saved. --> <!-- For example, on Linux/Unix: /tmp --> <!-- For example, on Windows: c:\temp --> <!-- When no value is specified, the default is the "javax.servlet.context.tempdir" ServletContext attribute set by the web container. --> <!-- When the special string java.io.tmpdir is specified, the service uses the Java system property with key "java.io.tmpdir" --> <param-name>com.ibm.ws.mobile.appsvcs.graphics.resultsTmpDir</param-name> <param-value>java.io.tmpdir</param-value> </init-param> ...
本节描述在 IBM WebSphere Application Server V8.5 中安装图形转换服务的过程。假定您熟悉应用程序服务器的应用程序安装和管理工作。
找到产品安装随附提供的图形转换服务企业归档 (EAR) 文件。可以在已安装 IBM WebSphere Application Server Web 2.0 and Mobile Toolkit 的安装树中找到该 EAR 文件。例如,如果已将 Toolkit 安装在以下位置中:
平台 | 位置 |
---|---|
Linux 和 UNIX: | /opt/WebSphere/Web20Mobile |
Windows: | c:\WebSphere\Web20Mobile |
那么可以在以下位置找到该 EAR 文件:
平台 | 位置 |
---|---|
Linux 和 UNIX: | /opt/WebSphere/Web20Mobile/installableApps/application_services/graphics/appsvcs-graphics.ear |
Windows: | c:\WebSphere\Web20Mobile\installableApps\application_services\graphics\appsvcs-graphics.ear |