[open] HTML help file, using relative path for image
Hello again,
I'm currently editing my help file send_message.HTML
for a plug-in that I wrote send_message
.
In my help file I want to include an image to display when the help file is accessed inside of opensesame. Currently I display the image by using the absolute path to the image.
<P><IMG SRC="C:\Program Files (x86)\OpenSesame\plugins\send_message\send_message_large.png" NAME="graphics2" ALIGN=BOTTOM WIDTH=32 HEIGHT=32 BORDER=0></P>
I would like to change from using an absolute path to a relative path, but when I do so my image can't be found.
<P><IMG SRC="send_message_large.png" NAME="graphics2" ALIGN=BOTTOM WIDTH=32 HEIGHT=32 BORDER=0></P>
I've asked around on forums on other websites for HTML specific questions and it seems as if this is the code I would have to use to accomplish this. Both of my send_message.HTML
and send_message_large.PNG
files are located in the send_message
folder. All of the HTML people I've talked to say to use <img src="send_message.png" />
for relative paths.
I'm wondering if opensesame copys the help file when loading in a plugin and calls the HTML file from somewhere else when the help file is accessed inside of opensesame which could cause the relative path to not be that same as when it was located in my plug-in folder?
If you have any suggestions of where to look for this problem please let me know, thank you.
Comments
Yes, if you specify only a file name, it is interpreted as a relative path. In fact, this works just fine on my system, but it could be an operating-system specific quirk of the QtWebKit component that is used for the browser.
No, the
.html
file is loaded directly (link).If you are sure that there is not a trivial reason for why this doesn't work, such as a typo, then relative paths apparently don't work as expected, perhaps due to a bug in QtWebKit. (This is possible, but since I find it a bit unlikely, I would double-check.) A workaround would be to use a remote image, and specify a URL instead, like so:
This works, but the obvious downside is that the system has to be online.
Btw, you could also consider creating a markdown style help-file, which is much easier to read and manage. In that case, the equivalent code would be:
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
My plugin will be used on offline computers unfortunately, otherwise I would go with that option. Also I don't want to switch to markdown because I'm trying to limit how much installation is required by someone to use my plugin. For now I'm just not including the image in my help file. If I finish everything else I might revisit the issue. Thank you for the response though!
Good luck! And just out of curiosity: What does the plug-in do exactly?
Check out SigmundAI.eu for our OpenSesame AI assistant!
The plugin offers 3 different options. Start server, send mark, and stop server. When start server is selected the plugin opens a client socket connection through a port to an outside server. The send mark option allows the user to send useful information or messages about what their experiment just did, is doing, or is going to do. The stop server option closes the client socket connection. All of these options also send out date/time stamps of when the event occurred.