在 Notes 和 Web 浏览器中预览时的图像 URL [英] Image URL when previewed in Notes and in Web Browser

查看:24
本文介绍了在 Notes 和 Web 浏览器中预览时的图像 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我们有一个带有以下代码片段的 XPage,它使用 javascript 公式显示图像:

Lets say we have a XPage with following code snippet which displays an image using javascript formula:

<xp:image id="image1"><xp:this.url><![CDATA[#{javascript:"actn005.gif"}]]></xp:this.url></xp:image> 

actn005.gif 作为图像资源存在于当前数据库中.当我单击在注释中预览"并获取源时,它会为图像显示如下内容:

actn005.gif is present in the current database as image resource. When I click on the "Preview in Notes" and get the source it displays something like this for Image:

<img id="view:_id1:image1" src="/xsp/Naveen/Experiments.nsf/xsp/actn005.gif" alt="" class="xspImage">

当我单击在 Web 浏览器中预览"并获取源时,它会为图像显示如下内容:

When I click on the "Preview in Web Browser" and get the source it displays something like this for Image:

<img id="view:_id1:image1" src="/Naveen/Experiments.nsf/actn005.gif" alt="" class="xspImage"> 

您可以看到,在Preview in Notes"的情况下,它在数据库路径前后添加了xsp.我的问题是为什么?图像在两种情况下都显示没有问题.但是,如果我有渲染图像的 XPage,可以调用它 - XPage_Rendering_Image.xsp.因此,XPage 代码

You can see that in case of "Preview in Notes" it adds xsp before and after the path of the database. My question is WHY? The image displays in both cases with no issues. But if I have XPage which renders image lets call it - XPage_Rendering_Image.xsp. Because of which the XPage code

<xp:image id="image1"><xp:this.url><![CDATA[#{javascript:"XPage_Rendering_Image.xsp"}]]></xp:this.url></xp:image> 

呈现为:

<img id="view:_id1:image1" src="/xsp/Naveen/Experiments.nsf/xsp/XPage_Rendering_Image.xsp" alt="" class="xspImage"> 

然后它失败了!我早些时候在 XPage 论坛上发布了这个问题,并建议使用像

and then it FAILS! I posted this question earlier on XPages forum and was suggested using a normal image tag like

<img src="#{javascript:'XPage_Rendering_Image.xsp'}" alt="" class="xspImage" />.

但是有没有办法使用 <xp:image> 标签来完成这项工作?这是一个错误吗?

But is there a way to make this work using <xp:image> tag? Is this a bug?

推荐答案

它可能不会像您希望的那样(以及许多其他人)工作,但它会按设计工作.如果您想提供自己的图像源(我假设 XPage_Rendering_Image.xsp 是一个 XAgent),您必须使用扩展 API 并提供资源渲染器.或者您坚持使用论坛中建议的标准 html img 标签.Notes 客户端中的 XSP 路径部分是必需的,以便本地 Web 服务器可以识别它将由 XSP 引擎呈现,而不是经典的客户端部分.

It might not work as you would like it (and many others), but it works as designed. If you want to provide your own image source (I presume the XPage_Rendering_Image.xsp is an XAgent) you have to use the Extension API and provide a resource renderer. Or you stick with the standard html img tag as suggested in the forum. The XSP path part in the Notes client is needed so the local web server can recognize that it is to be rendered by the XSP engine and not a classic client part.

更新:/xsp/.... URL 也适用于网络.所以这就是你所需要的.

Update: the /xsp/.... URL works on the web too. So that's what you need.

这篇关于在 Notes 和 Web 浏览器中预览时的图像 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆