grails图像的绝对路径(grails images absolute path)
我在我的标题模板中有这个图像
<img src="images/slide-1.jpg" alt="Slide #1" width="175" height="77" />
当从'main'目录内的gsp文件使用模板时,图像被加载。 虽然,如果我在控制器内的gsp文件内使用相同的模板,则不会加载图像。 我试图改变这一点:
<img src="images/slide-1.jpg" alt="Slide #1" width="175" height="77" />
对此:
<img src="../images/slide-1.jpg" alt="Slide #1" width="175" height="77" />
它可以工作,但现在其他页面中的图像不会。 任何想法来解决这个问题? 我知道关键必须是绝对路径。 但我做了一些搜索,没有发现任何东西。
I have this image in my header template
<img src="images/slide-1.jpg" alt="Slide #1" width="175" height="77" />
When the template is used from a gsp file inside the 'main' directory, the image is loaded. Although, if I have the same template being used inside a gsp file inside a controller, the image is not loaded. I have tried to change this:
<img src="images/slide-1.jpg" alt="Slide #1" width="175" height="77" />
to this:
<img src="../images/slide-1.jpg" alt="Slide #1" width="175" height="77" />
and it works, but now the image in the other page don't. Any idea to solve the problem? I know the key must be absolute path. But i've done some searches and found nothing.
原文:https://stackoverflow.com/questions/5944393
最满意答案
如果您尝试在界面构建器中的代码中重新创建接口,则需要查看Size Inspector:
首先,在界面构建器中选择一个元素:
现在查看右侧面板中的Size Inspector:
X,Y,Width和Height变量为您提供足够的信息来创建与元素大小相同的
CGRect
:CGRect editFrame = CGRectMake(233.0, 6.0, 67, 32);
If you're trying to recreate an interface in code that's in interface builder, you need to look at the Size Inspector:
First, select an element in interface builder:
Now look at the Size Inspector in the right-side panel:
The X, Y, Width and Height variables give you enough information to create a
CGRect
with the same size as the element:CGRect editFrame = CGRectMake(233.0, 6.0, 67, 32);
相关问答
更多-
原因是 ”?” (questionmark)中的项目名称(也许有与其他符号的错误 - 没有检查它)。 你可以尝试重新命名项目,或只是创建一个名称不带“?”的新项目。 在里面。 The reason is "?" (questionmark) in Project's name (maybe there is a bug with other symbols – didn't check it). You can try to rename Project or just create new one wit ...
-
我们发布了一个新版本,应该通过热门词汇样本解决语言选择问题: https ://pypi.python.org/pypi/google-assistant-sdk/0.4.1 你可以再次尝试使用错误报告中的说明吗? https://github.com/googlesamples/assistant-sdk-python/issues/146#issuecomment-354217352 We published a new release that should address the language ...
-
CGRect助手?(CGRect Assistant?)[2023-07-29]
如果您尝试在界面构建器中的代码中重新创建接口,则需要查看Size Inspector: 首先,在界面构建器中选择一个元素: 现在查看右侧面板中的Size Inspector: X,Y,Width和Height变量为您提供足够的信息来创建与元素大小相同的CGRect : CGRect editFrame = CGRectMake(233.0, 6.0, 67, 32); If you're trying to recreate an interface in code that's in interface ... -
说“好吧,Google - 用[您的应用]做[某些事]”,以便打开您的应用来完成查询,这称为Google语音操作,您可以轻松地将这些添加到您的应用中。 有关完整的详细信息,请参阅文档。 请注意 - 为了使这些工作起作用,您的应用程序必须位于Play商店中,并至少作为测试版上传。 Google智能助理有点不同 - 它更具有对话性,并且不会将用户直接带到您的应用中。 相反,它需要用户输入,查找适当的应用程序来处理查询,将查询提供给您的应用程序,然后在Google智能助理内部返回响应。 这完全是关于通过Googl ...
-
调度助手工具API(Scheduling Assistant tool API)[2021-12-20]
可以使用第三方库,如JWebDAV for Exchange 对于Exchange 2003,请使用“JWebDAV for Exchange”。 例子: http://www.independentsoft.de/jwebdav/tutorial/getfreebusyforspecifiedusers.html 对于Exchange 2007/2010/2013,请使用“JWebServices for Exchange”。 例子 http://www.independentsoft.de/jwebse ... -
从根本上说,函数是一个Express.js服务器,但不会让您了解Express的所有配置选项。 你有几个选择。 最简单的是在你的函数中明确地调用中间件本身。 来自Google的文档 : 如果您需要为cookie支持或CORS等内容注入中间件依赖项,请在函数中调用它们。 例如,要启用CORS支持,请添加以下块: // Enable CORS using the `cors` express middleware. cors(req, res, () => { // ... }); 还有更复杂的方法来挂钩 ...
-
创建新项目时,在“ Migrate To下拉框中指定目标数据库版本。 默认值为SQL Azure 。 我怀疑你没有检查下拉列表并创建了一个默认值的项目。 如果选择其他版本,例如SQL Server 2016或SQL Server 2014 ,则可以使用“ Connect to SQL Server按钮。 When you create a new project you specify the target database version in the Migrate To dropdown box. T ...
-
我相信这是3.2.0GA SDK中的一个错误(3.2.1和3.3.0尚未正式发布)。 据我所知,它已知并应在下一次SDK更新中修复。 唯一的问题是此更新何时结束。 您可以通过恢复到3.1.3GA获得内容辅助,但如果您需要3.2.0GA的功能,这对您没有多大帮助。 编辑:该问题在本JIRA票据中有所描述,因为它应该在即将发布的3.2.1版本中得到解决。 I believe this is a bug in the 3.2.0GA SDK (3.2.1 and 3.3.0 are not official re ...
-
在GTK +助手中打印变量(Print variable in GTK+ assistant)[2022-03-15]
在entry_changed ,你必须调用gtk_entry_set_text(GTK_ENTRY(page[2].widget), name); 再次,因为你只设置一次条目文本,这是唯一重要的事情。 否则,您在设置第3页时设置的默认值会粘住。 in entry_changed, you will have to call gtk_entry_set_text(GTK_ENTRY(page[2].widget), name); again, as you only set the entry text on ... -
有一个技巧,你可以尝试。 这是代码: let item = self.yourTextView.inputAssistantItem; item.leadingBarButtonGroups = []; item.trailingBarButtonGroups = []; There is a trick that you can try. Here is the code: let item = self.yourTextView.inputAssistantItem; item.leadingBarB ...